\clickhouse安装与启动**
操作步骤与用户 | 操作内容 | |
---|---|---|
创建用户/root | 1.创建用户 useradd clickhouse | |
解压安装包/root | 1. 上传安装包及单机配置文件到/home/clickhouseSvn路径:https://192.168.60.125/svn/非银绩效分析/06_实施/01_中信XT/部署/clickhouse1. 解压安装包 (clickhouse-client-22.3.6.5.tar.gz, clickhouse-common-static-22.3.6.5.tar.gz,clickhouse-server-22.3.6.5.tar.gz) cd /home/clickhouse ls *.tar.gz \ | xargs -n1 tar xzvf |
安装列式数据库/root | 1.安装公共包 ./clickhouse-common-static-22.3.6.5/install/doinst.sh 2.安装服务端./clickhouse-server-22.3.6.5/install/doinst.sh![]() ![]() ![]() |
|
防火墙增加端口配置/root | 1. 防火墙增加端口配置 firewall-cmd –add-port=8123/tcp –permanent firewall-cmd –add-port=9000/tcp –permanent firewall-cmd –add-port=9004/tcp –permanent 2. 重新加载防火墙配置 firewall-cmd –reload | |
创建数据挂载目录/root | 1. 创建数据挂载目录 (根据实际硬盘挂载目录再调整) mkdir -p /大空间目录/ck1此处使用mkdir -p /home/clickhouse/ck1(实际情况调整) 2. 给目录赋权 chown clickhouse:clickhouse -R /大空间目录/ck1此处使用chown clickhouse:clickhouse -R /home/clickhouse/ck1查看storage.xml里配置的存储路径![]() ![]() |
|
启动服务,同步数据/root | 1.启动服务 clickhouse start 2.登录客户端 clickhouse-client -h 127.0.0.1 -u cebrisk –password cebrisk若遇到登录错误时可查看日志检查是否与以下命令有关,如果有关,则需执行以下命令openssl dhparam -out /etc/clickhouse-server/dhparam.pem 4096相关命令存在于config.xml中,可查看相关解决问题openssl req -subj “/CN=localhost” -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/clickhouse-server/server.key -out /etc/clickhouse-server/server.crt | |
clickhouse-backup安装 | 0. cd /home/clickhouse1. tar -xf clickhouse-backup.tar 2. cd clickhouse-backup chmod +x clickhouse-backup3. cp clickhouse-backup /usr/local/bin4. 验证: clickhouse-backup –v![]() ![]() |
|
查看日志 | tail -200f /var/log/clickhouse-server/clickhouse-server.log | |
导入数据库脚本 | clickhouse-client -h 127.0.0.1 -u cebrisk –password cebrisk –multiquery < /home/clickhouse/20200627_clickhouse单库基础数据.sql** 注意到数据库脚本已经内部创建数据库,可根据实际修改![]() |