sudo docker pull yandex/clickhouse-server
sudo docker pull yandex/clickhouse-clinet

 sudo mkdir /mnt/sda/mount/docker/clickhouse

# 启动一个临时docker
sudo docker run --rm --name tmp --ulimit nofile=262144:262144  yandex/clickhouse-server

# 将临时docker配置cp到本地
sudo docker cp tmp:/etc/clickhouse-server/users.xml /mnt/sda/mount/docker/clickhouse/conf/users.xml
sudo docker cp tmp:/etc/clickhouse-server/config.xml /mnt/sda/mount/docker/clickhouse/conf/config.xml
# 停止临时docker
sudo docker container ps
# 删除临时dokcer
#启动挂载本地的docker
sudo docker run -itd --restart=always --name clickhouse-server  --ulimit nofile=262144:262144 -p 28123:8123 -p 29000:9000 -p 29009:9009 -v /mnt/sda/mount/docker/clickhouse/database:/var/lib/clickhouse:rw -v /mnt/sda/mount/docker/clickhouse/conf/config.xml:/etc/clickhouse-server/config.xml -v /mnt/sda/mount/docker/clickhouse/conf/users.xml:/etc/clickhouse-server/users.xml -v /mnt/sda/mount/docker/clickhouse/log:/var/log/clickhouse-server:rw yandex/clickhouse-server:latest
CREATE USER user1 HOST LIKE '%'  IDENTIFIED WITH sha256_password BY '123456';
grant all on *.* to tiger WITH GRANT OPTION;
<dba>
    <password>123456</password>
    <networks incl="networks" replace="replace">
        <ip>::/0</ip>
    </networks>
    <profile>default</profile>
    <quota>default</quota>
    <allow_databases>
        <database>default</database>
    </allow_databases>
    <access_management>1</access_management>
</dba>

打开 /etc/clickhouse-server

在<users> </users>标签里加上上面的密码配置

保存后,登陆

clickhouse-client --user "dba" --password "123456"

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐