本文介绍在Ubuntu 18.04/CentOS 7操作系统上安装ClickHouse analytic DBMS,ClickHouse是一个免费的开源列式数据库管理系统,允许实时生成分析数据报告。
在Ubuntu 18.04上安装ClickHouse的方法 对于Ubuntu用户,可以使用受支持的apt存储库(参考:Ubuntu存储库的定义及启用和禁用Ubuntu存储库的方法),通过运行以下命令添加它: echo "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" | sudo tee /etc/apt/sources.list.d/clickhouse.list 导入GPG密钥: $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 Executing: /tmp/apt-key-gpghome.t6IDTPxi7M/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 gpg: key C8F1E19FE0C56BD4: public key "ClickHouse Repository Key milovidov@yandex-team.ru" imported gpg: Total number processed: 1 gpg: imported: 1 然后运行以下命令来安装ClickHouse: sudo apt update sudo apt -y install dirmngr clickhouse-server clickhouse-client ClickHouse配置文件位于/etc/clickhouse-server/config.xml中。 启动ClickHouse并将服务设置为在启动时启动: $ sudo systemctl enable --now clickhouse-server.service Synchronizing state of clickhouse-server.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable clickhouse-server $ sudo systemctl is-enabled clickhouse-server.service enabled 确认服务是否正在运行,执行systemctl status clickhouse-server.service命令:
如果服务器无法启动,请在故障排除时检查/var/log/clickhouse-server/上的日志: $ ls /var/log/clickhouse-server/ clickhouse-server.err.log clickhouse-server.log
在CentOS 7上安装ClickHouse的方法 对于运行CentOS 7服务器的用户,你可以通过packagecloud存储库进行脚本式安装,确保系统上已安装curl: sudo yum install -y curl 运行安装程序脚本以将Packagecloud存储库添加到CentOS 7服务器: curl -s https://packagecloud.io/install/repositories/altinity/clickhouse/script.rpm.sh | sudo bash 确认ClickHouse软件包可供安装: $ sudo yum list 'clickhouse*'
现在安装ClickHouse服务器和客户端应用程序: sudo yum install -y clickhouse-server clickhouse-client 验证包是否已列为已安装: sudo yum list installed 'clickhouse*' 确保ClickHouse服务器已启动并设置为在服务器启动时启动: $ sudo systemctl start clickhouse-server $ sudo systemctl enable clickhouse-server clickhouse-server.service is not a native service, redirecting to /sbin/chkconfig. Executing /sbin/chkconfig clickhouse-server on 检查服务器现在是否正在运行,执行sudo systemctl status clickhouse-server命令:
使用clickhouse-client连接到ClickHouse服务器 启动服务器后,可以使用命令行客户端连接到它: $ clickhouse-client ClickHouse client version 19.4.1.3. Connecting to localhost:9000 as user default. Connected to ClickHouse server version 19.4.1 revision 54416. ubuntu-server 默认情况下,它将连接到localhost:9000作为用户默认值而没有密码,客户端还可用于使用--host参数连接到远程服务器: ubuntu-server :) SELECT 1 SELECT 1 1 rows in set. Elapsed: 0.008 sec. ubuntu-server :) 至此,目标达成。
相关主题 |