下载地址:http://repo.red-soft.biz/repos/clickhouse/stable/el6/
[root@kino100 software]# ls
clickhouse-client-1.1.54236-4.el6.x86_64.rpm
clickhouse-server-1.1.54236-4.el6.x86_64.rpm
clickhouse-compressor-1.1.54236-4.el6.x86_64.rpm
clickhouse-server-common-1.1.54236-4.el6.x86_64.rpm
clickhouse-debuginfo-1.1.54236-4.el6.x86_64.rpm
[root@kino100 software]# rpm -ivh *.rpm
Preparing... ########################################### [100%]
1:clickhouse-server-commo########################################### [ 20%]
2:clickhouse-server ########################################### [ 40%]
3:clickhouse-client ########################################### [ 60%]
4:clickhouse-debuginfo ########################################### [ 80%]
5:clickhouse-compressor ########################################### [100%]
前台启动:
[root@kino100 software]# clickhouse-server --config-file=/etc/clickhouse-server/config.xml
后台启动:
[root@kino100 software]# nohup clickhouse-server --config-file=/etc/clickhouse-server/config.xml >null 2>&1 &
[1] 2696
[root@kino100 software]# clickhouse-client
ClickHouse client version 1.1.54236.
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.54236.
:)
首先, 需要添加官方存储库:
sudo yum install yum-utils
sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64
如果想要安装最新版本, 将 stable
替换为 testing
(建议在测试环境中使用)
然后运行一下命令:
sudo yum install clickhouse-server clickhouse-client
可以运行如下命令在后台启动服务:
sudo service clickhouse-server start
可以在 /var/log/clickhouse-server/
目录中查看日志。
如果服务没有启动,请检查配置文件: /etc/clickhouse-server/config.xml
。
你也可以在控制台中直接启动服务:
clickhouse-server --config-file=/etc/clickhouse-server/config.xml
在这种情况下,日志将被打印到控制台中,这在开发过程中很方便。
如果配置文件在当前目录中,你可以不指定–config-file
参数。它默认使用./config.xml
。
clickhouse-client
默认情况下它使用’default’用户无密码的与localhost:9000服务建立连接。
客户端也可以用于连接远程服务,例如:
clickhouse-client --host=example.com
检查系统是否工作:
milovidov@hostname:~/work/metrica/src/src/Client$ ./clickhouse-client
ClickHouse client version 0.0.18749.
Connecting to localhost:9000.
Connected to ClickHouse server version 0.0.18749.
:) SELECT 1
SELECT 1
┌─1─┐
│ 1 │
└───┘
1 rows in set. Elapsed: 0.003 sec.
:)
[root@kino100 ~]# vim /etc/clickhouse-server/config.xml
<listen_host>::</listen_host>
<!-- <listen_host>::1</listen_host> -->
<!-- <listen_host>127.0.0.1</listen_host> -->
[root@kino101 ~]# vim /etc/clickhouse-server/config.xml
<listen_host>::</listen_host>
<!-- <listen_host>::1</listen_host> -->
<!-- <listen_host>127.0.0.1</listen_host> -->
[root@hadoop104 ~]# vim /etc/clickhouse-server/config.xml
<listen_host>::</listen_host>
<!-- <listen_host>::1</listen_host> -->
<!-- <listen_host>127.0.0.1</listen_host> -->
[root@kino100 ~]# vim /etc/metrika.xml
添加如下内容:
<yandex>
<clickhouse_remote_servers>
<perftest_3shards_1replicas>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>hadoop102</host>
<port>9000</port>
</replica>
</shard>
<shard>
<replica>
<internal_replication>true</internal_replication>
<host>hadoop103</host>
<port>9000</port>
</replica>
</shard>
<shard>
<internal_replication>true</internal_replication>
<replica>
<host>hadoop104</host>
<port>9000</port>
</replica>
</shard>
</perftest_3shards_1replicas>
</clickhouse_remote_servers>
<zookeeper-servers>
<node index="1">
<host>kino100</host>
<port>2181</port>
</node>
<node index="2">
<host>kino101</host>
<port>2181</port>
</node>
<node index="3">
<host>kino102</host>
<port>2181</port>
</node>
</zookeeper-servers>
<macros>
<replica>kino100</replica>
</macros>
<networks>
<ip>::/0</ip>
</networks>
<clickhouse_compression>
<case>
<min_part_size>10000000000</min_part_size>
<min_part_size_ratio>0.01</min_part_size_ratio>
<method>lz4</method>
</case>
</clickhouse_compression>
</yandex>
注意:上面 需要根据机器不同去修改
首先在三台机器开启Zookeeper 前台启动:
[root@kino software]# clickhouse-server --config-file=/etc/clickhouse-server/config.xml
后台启动:
[root@kino software]# nohup clickhouse-server --config-file=/etc/clickhouse-server/config.xml >null 2>&1 &
[1] 2696