问题描述
今天修改了clickhouse的配置之后, clickhouse就无法启动了, 启动之后日志也不打印任何信息
# 下面的命令 无法启动 clickhous
systemctl start clickhouse-server
查看clickhouse 状态
[root@node2 clickhouse-server]# sudo systemctl status clickhouse-server
● clickhouse-server.service - ClickHouse Server (analytic DBMS for big data)
Loaded: loaded (/etc/systemd/system/clickhouse-server.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since 二 2021-04-19 17:10:44 CST; 3s ago
Process: 8933 ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid (code=exited, status=232/ADDRESS_FAMILIES)
Main PID: 8933 (code=exited, status=232/ADDRESS_FAMILIES)
4月 19 17:10:44 node2 systemd[1]: Unit clickhouse-server.service entered failed state.
4月 19 17:10:44 node2 systemd[1]: clickhouse-server.service failed.
查看日志
[root@node2 clickhouse-server]# clickhouse-server --config-file=/etc/clickhouse-server/config.xml
Processing configuration file '/etc/clickhouse-server/config.xml'.
Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = SAXParseException: Tag mismatch in '/etc/clickhouse-server/config.xml', line 522 column 8, Stack trace (when copying this message, always include the lines below):
0. Poco::XML::SAXParseException::SAXParseException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::XML::Locator const&) @ 0x12795b3e in /usr/bin/clickhouse
1. Poco::XML::ParserEngine::handleError(int) @ 0x1279e1d8 in /usr/bin/clickhouse
2. Poco::XML::ParserEngine::parseByteInputStream(std::__1::basic_istream<char, std::__1::char_traits<char> >&) @ 0x1279d20e in /usr/bin/clickhouse
3. Poco::XML::ParserEngine::parse(Poco::XML::InputSource*) @ 0x1279c8b7 in /usr/bin/clickhouse
4. Poco::XML::SAXParser::parse(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x12798bb9 in /usr/bin/clickhouse
5. Poco::XML::DOMBuilder::parse(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x1277bb48 in /usr/bin/clickhouse
6. Poco::XML::DOMParser::parse(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x1277a723 in /usr/bin/clickhouse
7. DB::ConfigProcessor::processConfig(bool*, zkutil::ZooKeeperNodeCache*, std::__1::shared_ptr<Poco::Event> const&) @ 0x103a299e in /usr/bin/clickhouse
8. DB::ConfigProcessor::loadConfig(bool) @ 0x103a52e2 in /usr/bin/clickhouse
9. BaseDaemon::reloadConfiguration() @ 0x8a6f0be in /usr/bin/clickhouse
10. BaseDaemon::initialize(Poco::Util::Application&) @ 0x8a70cbe in /usr/bin/clickhouse
11. DB::Server::initialize(Poco::Util::Application&) @ 0x8928060 in /usr/bin/clickhouse
12. Poco::Util::Application::run() @ 0x12750876 in /usr/bin/clickhouse
13. DB::Server::run() @ 0x8927ecf in /usr/bin/clickhouse
14. mainEntryClickHouseServer(int, char**) @ 0x8926b45 in /usr/bin/clickhouse
15. main @ 0x88b114e in /usr/bin/clickhouse
16. __libc_start_main @ 0x22555 in /usr/lib64/libc-2.17.so
17. _start @ 0x887c3ee in /usr/bin/clickhouse
(version 21.4.3.21 (official build))
问题定位
看日志, 应该是配置的 config.xml
文件解析异常, 我们到config.xml
对应的行去检查一下。
解决问题
. . . 省略 . . .
<two_shard>
<shard>
<replica>
<host>node3</host>
<port>9977</port>
</replica>
</shard>
<shard>
<replica>
<host>node2</host>
<port>9977</port><!-- 这里下面少了一个 <replica> 补上之后再次启动-->
</shard>
</two_shard>
. . . 省略 . . .