You can finish this article in about 1 minute at 🕰️
🎨 preface
This blog mainly describes three points:
- Configure a password
- Enabling remote Connection
- Install ClickHouse under CentOS
💻 body
Install ClickHouse on CentOS
- DEB installation package
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 echo "deb https://repo.clickhouse.tech/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-clientCopy the code
- The RPM installation package
sudo yum install yum-utils
sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64
Copy the code
Configure a password
Clikchouse default user name default, default password is empty,
- Generate the password
PASSWORD=$(base64 < /dev/urandom | head -c8);
echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-'
Copy the code
Save sha256Sum (the long string) to the configuration file as follows; The short string is the password we used to connect, be sure to use notepad to save the generated result
- Edit user. XML
vim /etc/clickhouse-server/users.xml
Copy the code
Find the users -> default -> password TAB, open the comment and change it to password_sha256_HEX, resulting in the following image
- Restart clickhouse server
service clickhouse-server restart
Copy the code
- test
Clickhouse-client -h 127.0.0.1 -u default --password g7nfwf5qCopy the code
Enabling remote Connection
- Edit config. XML
vim /etc/clickhouse-server/config.xml
Copy the code
Open the comment on the Listen_host TAB and the final result is shown below
- Release port
The default clickhouse port is 8123; If the server is used by Tencent Cloud, you also need to check whether the port is allowed in Tencent cloud console
First, execute the following command, which can be ignored if the terminal displays that a new file has been created
vim /etc/iptables/rules.v4
Copy the code
Add -a INPUT -p TCP -m TCP –dport 8123 -j ACCEPT. The result is as follows
service iptables restart
Copy the code
- test
Here I’m using a third-party visualization tool called DataGrip to connect to ClickHouse remotely
More third-party visualization tools
- Restart clickhouse server
service clickhouse-server restart
Copy the code
🎉 epilogue
ClickHouse is installed and compiled on MacOS, and github.com/xxx not found is often found during installation. In practice, I recommend installing ClickHouse in CentOS or Docker, which is very fast. As for third-party tools, using DataGrip also gives me a lot of convenience, such as viewing, management and so on.
My technical ability is limited, if there is a wrong place to write, please leave a message as if correct, very thank 🙇
If your problem is not solved, first of all, I am very sorry for your time. You can leave a message in the comments section below, and I will reply to 🙍♂️ as soon as I see it
🎒 References
ClickHouse is a fast open-source OLAP database management system