Mirror site is read only www.netnr.com
netnr/ install-clickhouse.sh 2024-04-05 16:40
安装 ClickHouse
# ref https://clickhouse.com/docs/en/install

# docker 方式
docker run --restart=always --name clickhouse \
  --ulimit nofile=262144:262144 \
  --volume=$PWD/data:/var/lib/clickhouse \
  -p 8123:8123 \
  -p 9000:9000 \
  -e CLICKHOUSE_USER=default \
  -e CLICKHOUSE_PASSWORD=123456 \
  -d yandex/clickhouse-server

# yum 方式
yum install yum-utils
yum-config-manager --add-repo https://packages.clickhouse.com/rpm/clickhouse.repo
yum install clickhouse-server clickhouse-client
# 服务
systemctl enable clickhouse-server
systemctl start clickhouse-server
systemctl status clickhouse-server

# 启动服务 stop restart 等
/etc/init.d/clickhouse-server start

# 开启远程
lsof -i :8123 # 查看端口监听情况
vi /etc/clickhouse-server/config.xml
# 找到下面一行去掉注释,修改后重启生效
<listen_host>::</listen_host>

# 设置密码
vi /etc/clickhouse-server/users.xml
# 修改后重启生效
<password>123456</password>