Oracle Linuxのセットアップ
以下を参考。
今回は以下を利用。
環境
Oracle Linux Server release 9.4
NAME="Oracle Linux Server"
VERSION="9.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.4
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.4
Red Hat Enterprise Linux release 9.4 (Plow)
Oracle Linux Server release 9.4
事前セットアップ
selinux無効化
sudo vi /etc/sysconfig/selinux
- SELINUX=enforcing
+ SELINUX=disabled
リブート
sudo reboot
selinux無効化確認
getenforce
Disabled
になっていればOK。
firewalld停⽌
sudo systemctl stop firewalld
systemctl status firewalld
Active: inactive (dead)
と表示されていればOK。
firewalldの自動起動無効化
sudo systemctl disable firewalld
systemctl is-enabled firewalld
disabled
になっていればOK。
ClickHouseのインストール
RPM repositoryのセットアップ
今回はltsをインストールする。
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://packages.clickhouse.com/rpm/clickhouse.repo
sudo sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/clickhouse.repo
cat /etc/yum.repos.d/clickhouse.repo
[clickhouse-stable]
name=ClickHouse - Stable Repository
baseurl=https://packages.clickhouse.com/rpm/stable/
gpgkey=https://packages.clickhouse.com/rpm/stable/repodata/repomd.xml.key
gpgcheck=0
repo_gpgcheck=1
enabled=0
[clickhouse-lts]
name=ClickHouse - LTS Repository
baseurl=https://packages.clickhouse.com/rpm/lts/
gpgkey=https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key
gpgcheck=0
repo_gpgcheck=1
enabled=0
yumキャッシュ作成
sudo yum -q makecache -y --disablerepo='*' --enablerepo='clickhouse-lts'
Clickhouse(server, client)インストール
sudo yum -y --enablerepo=clickhouse-lts install clickhouse-server clickhouse-client
listen_hostを0.0.0.0に変更(どこからでも接続許可)
sudo vi /etc/clickhouse-server/config.xml
<!-- Listen specified address.
Use :: (wildcard IPv6 address), if you want to accept connections both with IPv4 and IPv6 from everywhere.
Notes:
If you open connections from wildcard address, make sure that at least one of the following measures applied:
- server is protected by firewall and not accessible from untrusted networks;
- all users are restricted to subset of network addresses (see users.xml);
- all users have strong passwords, only secure (TLS) interfaces are accessible, or connections are only made via TLS interfaces.
- users without password have readonly access.
See also: https://www.shodan.io/search?query=clickhouse
-->
<!-- <listen_host>::</listen_host> -->
<!-- Same for hosts without support for IPv6: -->
<!-- <listen_host>0.0.0.0</listen_host> -->
<listen_host>0.0.0.0</listen_host>
defaultユーザ⽤パスワード⽣成
export HISTCONTROL=ignorespace
echo -n "password" | sha256sum | tr -d '-'
unset HISTCONTROL
ハッシュ値を控えておく。
5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
パスワードを設定。
sudo sed -i -e "s/<password><\/password>/<password_sha256_hex>5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8<\/password_sha256_hex>/g" /etc/clickhouse-server/users.xml
Clickhouseサービス登録
sudo systemctl enable clickhouse-server
sudo systemctl start clickhouse-server
systemctl status clickhouse-server
defaultユーザログイン確認
パスワードはpassword
。
clickhouse-client -u default --password --host=127.0.0.1
ClickHouse client version 24.3.6.48 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 24.7.3.
ClickHouse client version is older than ClickHouse server. It may lack support for new features.
Warnings:
* Linux transparent hugepages are set to "always". Check /sys/kernel/mm/transparent_hugepage/enabled
* Linux threads max count is too low. Check /proc/sys/kernel/threads-max
* Delay accounting is not enabled, OSIOWaitMicroseconds will not be gathered. You can enable it using `echo 1 > /proc/sys/kernel/task_delayacct` or by using sysctl.
* Maximum number of threads is lower than 30000. There could be problems with handling a lot of simultaneous queries.
localhost :)
バージョン確認
clickhouse --version
ClickHouse local version 24.3.6.48 (official build).
clickhouse-client --version
ClickHouse client version 24.3.6.48 (official build).