I need to transfer some tables with data between two servers. I tried using clickhouse-copier, but I get SAXParseException: Syntax error in line 1 column 0. I don't know what's wrong with my task. I've add <?xml version="1.0"?>
at the beginning, but error in line 1 column 0 remain.
Task.xml:
<?xml version="1.0"?>
<clickhouse>
<remote_servers>
<source_cluster>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>server1_ip</host>
<port>9000</port>
</replica>
</shard>
</source_cluster>
<destination_cluster>
<shard>
<internal_replication>false</internal_replication>
<replica>
<host>server2_ip</host>
<port>9000</port>
</replica>
</shard>
</destination_cluster>
</remote_servers>
<max_workers>4</max_workers>
<settings_pull>
<readonly>1</readonly>
</settings_pull>
<settings_push>
<readonly>0</readonly>
</settings_push>
<settings>
<connect_timeout>3</connect_timeout>
<insert_distributed_sync>1</insert_distributed_sync>
</settings>
<tables>
<table1>
<cluster_pull>source_cluster</cluster_pull>
<database_pull>db_name</database_pull>
<table_pull>table1</table_pull>
<cluster_push>destination_cluster</cluster_push>
<database_push>db_name</database_push>
<table_push>table1</table_push>
<engine>
some_engine
</engine>
<sharding_key>jumpConsistentHash(intHash64(UserID), 2)</sharding_key>
</table1>
...
</tables>
</clickhouse>
Error log:
2022.10.04 17:00:46.568806 [ 4017 ] {} <Error> : virtual int DB::ClusterCopierApp::main(const std::vector<std::string> &): Poco::Exception. Code: 1000, e.code() = 0, SAXParseException: Syntax error in line 1 column 0, Stack trace (when copying this message, always include the lines below):
0. ./build_docker/../contrib/poco/XML/src/XMLException.cpp:0: Poco::XML::SAXParseException::SAXParseException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::XML::Locator const&) @ 0x15a6461e in /usr/bin/clickhouse
1. ./build_docker/../contrib/poco/XML/src/ParserEngine.cpp:0: Poco::XML::ParserEngine::handleError(int) @ 0x15a693e0 in /usr/bin/clickhouse
2. ? @ 0x15a6865c in /usr/bin/clickhouse
3. ./build_docker/../contrib/poco/XML/src/ParserEngine.cpp:249: Poco::XML::ParserEngine::parse(Poco::XML::InputSource*) @ 0x15a67c73 in /usr/bin/clickhouse
4. ./build_docker/../contrib/poco/XML/src/DOMBuilder.cpp:101: Poco::XML::DOMBuilder::parse(Poco::XML::InputSource*) @ 0x15a4d298 in /usr/bin/clickhouse
5. ./build_docker/../contrib/poco/XML/src/DOMParser.cpp:0: Poco::XML::DOMParser::parse(Poco::XML::InputSource*) @ 0x15a4c5e5 in /usr/bin/clickhouse
6. ./build_docker/../contrib/poco/Util/src/XMLConfiguration.cpp:0: Poco::Util::XMLConfiguration::load(Poco::XML::InputSource*, unsigned long) @ 0x15a3f789 in /usr/bin/clickhouse
7. ./build_docker/../contrib/poco/Util/src/XMLConfiguration.cpp:0: DB::getConfigurationFromXMLString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x7ab7075 in /usr/bin/clickhouse
8. ./build_docker/../programs/copier/ClusterCopier.cpp:244: DB::ClusterCopier::reloadTaskDescription() @ 0x7a55915 in /usr/bin/clickhouse
9. ./build_docker/../contrib/poco/Foundation/include/Poco/AutoPtr.h:231: DB::ClusterCopier::init() @ 0x7a5301c in /usr/bin/clickhouse
10. ./build_docker/../contrib/libcxx/include/__memory/shared_ptr.h:816: DB::ClusterCopierApp::mainImpl() @ 0x7a501b1 in /usr/bin/clickhouse
11. ./build_docker/../programs/copier/ClusterCopierApp.cpp:0: DB::ClusterCopierApp::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) @ 0x7a50c5d in /usr/bin/clickhouse
12. ./build_docker/../contrib/poco/Util/src/Application.cpp:0: Poco::Util::Application::run() @ 0x15a244a2 in /usr/bin/clickhouse
13. ./build_docker/../programs/copier/ClusterCopierApp.cpp:0: mainEntryClickHouseClusterCopier(int, char**) @ 0x7a50f2e in /usr/bin/clickhouse
14. ./build_docker/../programs/main.cpp:0: main @ 0x78d8beb in /usr/bin/clickhouse
15. __libc_start_main @ 0x2409b in /usr/lib/x86_64-linux-gnu/libc-2.28.so
16. _start @ 0x76b07ee in /usr/bin/clickhouse
(version 22.10.1.400 (official build))
CodePudding user response:
The problem was with my ZooKeeper server. After replacing it with ClickHouse Keeper, everything works fine.