微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决无法在 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,line 202,in _create_socket
    for res in socket.getaddrinfo(host,port,socket.soCK_STREAM):
  File "/usr/local/lib/python3.8/socket.py",line 918,in getaddrinfo
    for res in _socket.getaddrinfo(host,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",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,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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。