无法 运行 在 CentOS 上自托管哨兵

Not able to run self-hosted sentry on CentOS

我正在尝试根据此文档在 CentOS(CentOS Linux 7.9.2009 版(核心版))上安装自托管哨兵 - https://develop.sentry.dev/self-hosted/.
但是当我 运行 sudo ./install.sh 我得到这个错误:

 Failed to connect to clickhouse:9000
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 260, in connect
    return self._init_connection(host, port)
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 226, in _init_connection
    self.socket = self._create_socket(host, port)
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 202, in _create_socket
    for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
Connection to Clickhouse cluster clickhouse:9000 failed (attempt 9)
Traceback (most recent call last):
  File "/usr/src/snuba/snuba/clickhouse/native.py", line 81, in execute
    result: Sequence[Any] = conn.execute(
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/client.py", line 205, in execute
    self.connection.force_connect()
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 180, in force_connect
    self.connect()
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 279, in connect
    raise err
clickhouse_driver.errors.NetworkError: Code: 210. Name or service not known (clickhouse:9000)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/snuba/snuba/migrations/connect.py", line 30, in check_clickhouse_connections
    check_clickhouse(clickhouse)
  File "/usr/src/snuba/snuba/migrations/connect.py", line 49, in check_clickhouse
    ver = clickhouse.execute("SELECT version()")[0][0]
  File "/usr/src/snuba/snuba/clickhouse/native.py", line 96, in execute
    raise ClickhouseError(e.code, e.message) from e
snuba.clickhouse.errors.ClickhouseError: [210] Name or service not known (clickhouse:9000)
Failed to connect to clickhouse:9000
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 260, in connect
    return self._init_connection(host, port)
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 226, in _init_connection
    self.socket = self._create_socket(host, port)
  File "/usr/local/lib/python3.8/site-packages/clickhouse_driver/connection.py", line 202, in _create_socket
    for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

来自 docker-compose logs clickhouse 的错误:

clickhouse_1                                | Processing configuration file '/etc/clickhouse-server/config.xml'.
clickhouse_1                                | Merging configuration file '/etc/clickhouse-server/config.d/docker_related_config.xml'.
clickhouse_1                                | Merging configuration file '/etc/clickhouse-server/config.d/sentry.xml'.
clickhouse_1                                | Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = Exception: Failed to merge config with '/etc/clickhouse-server/config.d/sentry.xml': Access to file denied: /etc/clickhouse-server/config.d/sentry.xml, Stack trace (when copying this message, always include the lines below):
clickhouse_1                                |
clickhouse_1                                | 0. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x105351b0 in /usr/bin/clickhouse
clickhouse_1                                | 1. ? @ 0xdefbd83 in /usr/bin/clickhouse
clickhouse_1                                | 2. DB::ConfigProcessor::loadConfig(bool) @ 0xdef9e97 in /usr/bin/clickhouse
clickhouse_1                                | 3. BaseDaemon::reloadConfiguration() @ 0x9157010 in /usr/bin/clickhouse
clickhouse_1                                | 4. BaseDaemon::initialize(Poco::Util::Application&) @ 0x91597d2 in /usr/bin/clickhouse
clickhouse_1                                | 5. DB::Server::initialize(Poco::Util::Application&) @ 0x8f96458 in /usr/bin/clickhouse
clickhouse_1                                | 6. Poco::Util::Application::run() @ 0x10457659 in /usr/bin/clickhouse
clickhouse_1                                | 7. DB::Server::run() @ 0x8f96045 in /usr/bin/clickhouse
clickhouse_1                                | 8. mainEntryClickHouseServer(int, char**) @ 0x8f8ce23 in /usr/bin/clickhouse
clickhouse_1                                | 9. main @ 0x8ee8799 in /usr/bin/clickhouse
clickhouse_1                                | 10. __libc_start_main @ 0x21b97 in /lib/x86_64-linux-gnu/libc-2.27.so
clickhouse_1                                | 11. _start @ 0x8ee802e in /usr/bin/clickhouse
clickhouse_1                                |  (version 20.3.9.70 (official build))
clickhouse_1                                | Processing configuration file '/etc/clickhouse-server/config.xml'.
clickhouse_1                                | Merging configuration file '/etc/clickhouse-server/config.d/docker_related_config.xml'.
clickhouse_1                                | Merging configuration file '/etc/clickhouse-server/config.d/sentry.xml'.
clickhouse_1                                | Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = Exception: Failed to merge config with '/etc/clickhouse-server/config.d/sentry.xml': Access to file denied: /etc/clickhouse-server/config.d/sentry.xml, Stack trace (when copying this message, always include the lines below):

Clickhouse 日志中存在错误 - Access to file denied: /etc/clickhouse-server/config.d/sentry.xml(类似问题 - https://forum.sentry.io/t/click-house-giving-permission-errors/12418)。如何为该文件设置正确的权限?

通过为哨兵安装的某些文件夹提供 777 权限 来修复它。我知道它可能不适合某些人,但它是简单快捷的解决方案。

sudo chmod -R 777 ./clickhouse
sudo chmod -R 777 ./relay
sudo chmod -R 777 ./sentry
sudo chmod -R 777 ./postgress