vagrant下体验clickhouse

1)安装,看这里
使用apt安装:
sudo apt-get install dirmngr sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 echo "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list sudo apt-get update sudo apt-get install -y clickhouse-server clickhouse-client sudo service clickhouse-server start clickhouse-client


使用deb包安装:
如果你不想通过修改更新源来安装ClickHouse或者你的机器访问不了外网,那么你可以通过下载deb的安装包来进行安装
下载地址:Index of /clickhouse/deb/stable/main/
你需要下载 clickhouse-client,clickhouse-server,clickhouse-common-static
安装命令如下:
dpkg -i clickhouse-common-static_19.9.3.31_amd64.deb
dpkg -i clickhouse-client_19.9.3.31_all.deb
dpkg -i clickhouse-server_19.9.3.31_all.deb
安装过程中会提示输入密码

2)、启动:
sudo service clickhouse-server start
停止:sudo service clickhouse-server stop
重新启动:sudo service clickhouse-server restart

也可使用 sudo /etc/init.d/clickhouse-server start来启动,其他类似

3)、使用clickhouse-client
clickhouse-client --password --multiline,然后输入刚刚安装时设置的密码


问题1、win7下使用dbeaver无法连接vagrant下的clickhouse服务
解决:1)、修改了vagrant的public_address设置,
config.vm.network "public_network" , ip: "10.205.0.200"
将ip设置为和win7一个网段的ip
2)、修改clickhouse-server的配置文件,设置为允许远程连接,看这里
vim /etc/clickhouse-server/config.xml

<!-- Listen specified host. use :: (wildcard IPv6 address), if you want to accept connections both with IPv4 and IPv6 from everywhere. --> <!--<listen_host>::</listen_host> --> <!-- Same for hosts with disabled ipv6: --> <!-- <listen_host>0.0.0.0</listen_host> --> <!-- Default values - try listen localhost on ipv4 and ipv6: --> <!-- <listen_host>::1</listen_host> <listen_host>127.0.0.1</listen_host> --> <!-- Don't exit if ipv6 or ipv4 unavailable, but listen_host with this protocol specified --> <!-- <listen_try>0</listen_try> -->

将注释掉的<listen_host>::</listen_host>取消注释,然后重启服务


如何建表,看这里
示例:
create table chain_state(addr String,bal UInt64,update_date date)ENGINE = MergeTree(update_date,(addr),8192)