{"id":361,"date":"2023-08-03T05:39:20","date_gmt":"2023-08-03T05:39:20","guid":{"rendered":"http:\/\/192.168.0.142\/?p=361"},"modified":"2023-08-03T09:38:24","modified_gmt":"2023-08-03T09:38:24","slug":"installation-of-clickhouse-on-ubuntu-22-04","status":"publish","type":"post","link":"http:\/\/192.168.0.142\/installation-of-clickhouse-on-ubuntu-22-04\/","title":{"rendered":"ClickHouse installation on Ubuntu 22.04"},"content":{"rendered":"\n
ClickHouse is an open-source column-oriented database management system that allows generating analytical data reports in real-time.<\/p>\n\n\n\n
OLAP scenarios require real-time responses on top of large datasets for complex analytical queries with the following characteristics:<\/p>\n\n\n\n
Update package index files<\/strong><\/p>\n\n\n\n Install dependencies<\/strong><\/p>\n\n\n\n Import ClickHouse GPG Key<\/strong><\/p>\n\n\n\n Add APT repository to Ubuntu 22.04<\/strong><\/p>\n\n\n\n Update package index files<\/strong><\/p>\n\n\n\n Install ClickHouse server and client<\/strong><\/p>\n\n\n\n Note : Enter password for default user when prompted during installation.<\/strong><\/p>\n\n\n\n Start ClickHouse server by running below command<\/strong><\/p>\n\n\n\n Access ClickHouse using clickhouse-client<\/strong><\/p>\n\n\n\n Terminal output for reference<\/strong><\/p>\n\n\n\n Create a database<\/strong><\/p>\n\n\n\n Terminal output for reference<\/strong><\/p>\n\n\n\n Create a table<\/strong><\/p>\n\n\n\n The above command will create a MergeTree<\/strong> table with four columns:<\/p>\n\n\n\n user_id<\/strong>: it is used to assign a 32-bit unsigned integer Insert some data into the table<\/strong><\/p>\n\n\n\n Get the table data<\/strong><\/p>\n\n\n\n Terminal output for reference<\/p>\n\n\n\n ClickHouse is an open-source column-oriented database management system that allows generating analytical data reports in real-time. OLAP scenarios require real-time responses on top of large datasets for complex analytical queries with the following characteristics: Update package index files Install dependencies Import ClickHouse GPG Key Add APT repository to Ubuntu 22.04 Update package index files Install … Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":427,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[31,12],"_links":{"self":[{"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/posts\/361"}],"collection":[{"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/comments?post=361"}],"version-history":[{"count":32,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/posts\/361\/revisions"}],"predecessor-version":[{"id":471,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/posts\/361\/revisions\/471"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/media\/427"}],"wp:attachment":[{"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/media?parent=361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/categories?post=361"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/tags?post=361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}sudo apt update<\/code><\/pre>\n\n\n\n
sudo apt install apt-transport-https ca-certificates dirmngr -y<\/code><\/pre>\n\n\n\n
GNUPGHOME=$(mktemp -d)\nsudo GNUPGHOME=\"$GNUPGHOME\" gpg --no-default-keyring --keyring \/usr\/share\/keyrings\/clickhouse-keyring.gpg --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv-keys 8919F6BD2B48D754\nsudo rm -r \"$GNUPGHOME\"\nsudo chmod +r \/usr\/share\/keyrings\/clickhouse-keyring.gpg<\/code><\/pre>\n\n\n\n
echo \"deb [signed-by=\/usr\/share\/keyrings\/clickhouse-keyring.gpg] https:\/\/packages.clickhouse.com\/deb stable main\" | sudo tee \\\n \/etc\/apt\/sources.list.d\/clickhouse.list<\/code><\/pre>\n\n\n\n
sudo apt update<\/code><\/pre>\n\n\n\n
sudo apt install clickhouse-server clickhouse-client -y<\/code><\/pre>\n\n\n\n
sudo service clickhouse-server start<\/code><\/pre>\n\n\n\n
clickhouse-client<\/code><\/pre>\n\n\n\n
$ clickhouse-client\r\nClickHouse client version 23.7.1.2470 (official build).\r\nConnecting to localhost:9000 as user default.\r\nPassword for user (default): \r\nConnecting to localhost:9000 as user default.\r\nConnected to ClickHouse server version 23.7.1 revision 54464.\r\n\r\nWarnings:\r\n * Maximum number of threads is lower than 30000. There could be problems with handling a lot of simultaneous queries.\r\n\r\nabb :)<\/code><\/pre>\n\n\n\n
CREATE DATABASE hyrule<\/code><\/pre>\n\n\n\n
abb :) CREATE DATABASE hyrule\r\n\r\nCREATE DATABASE hyrule\r\n\r\nQuery id: fa4aae46-f2e8-403c-a1e8-2f8bad0a6ec6\r\n\r\nOk.\r\n\r\n0 rows in set. Elapsed: 0.003 sec.<\/code><\/pre>\n\n\n\n
CREATE TABLE hyrule.warriors\n(\r\n user_id UInt32,\r\n name String,\r\n timestamp DateTime,\r\n strength Float32\r\n)\r\nENGINE = MergeTree()\r\nPRIMARY KEY (user_id, timestamp)<\/code><\/pre>\n\n\n\n
name<\/strong>: a String data type holds the name
timestamp<\/strong>: a DateTime value to represent time
strength<\/strong>: a 32-bit floating point number<\/p>\n\n\n\nINSERT INTO hyrule.warriors (user_id, name, timestamp, strength) VALUES\n(701, 'Link', now(), 99.99 ),\n(702, 'King Daphnes', today(), 98.88 ),\n(703, 'Ganondorf', yesterday(), 97.99 ),\n(704, 'Zant', now()-1, 90.39 )<\/code><\/pre>\n\n\n\n
SELECT * from hyrule.warriors<\/code><\/pre>\n\n\n\n
abb :) SELECT * from hyrule.warriors\r\n\r\nSELECT *\r\nFROM hyrule.warriors\r\n\r\nQuery id: 4f0bd822-836b-496d-b071-e7342d5e7d81\r\n\r\n\u250c\u2500user_id\u2500\u252c\u2500name\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500timestamp\u2500\u252c\u2500strength\u2500\u2510\r\n\u2502 701 \u2502 Link \u2502 2023-08-03 09:36:34 \u2502 99.99 \u2502\r\n\u2502 702 \u2502 King Daphnes \u2502 2023-08-03 00:00:00 \u2502 98.88 \u2502\r\n\u2502 703 \u2502 Ganondorf \u2502 2023-08-02 00:00:00 \u2502 97.99 \u2502\r\n\u2502 704 \u2502 Zant \u2502 2023-08-03 09:36:33 \u2502 90.39 \u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n\r\n4 rows in set. Elapsed: 0.002 sec. <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"