Clickhouse Windows10安装问题记录
版本信息
Clickhouse 24.6.2.17 (docker pull默认的latest版本)
Windows 10
WSL2 2.2.4.0
Ubuntu 22.04.3
Error log输出Permission Denied
问题描述
错误日志clickhouse-server.log和clickhouse-server.err.log不停地输出如下内容:
2024.08.12 05:37:59.156943 [ 696 ] {} <Error> void DB::SystemLog<DB::TraceLogElement>::flushImpl(const std::vector<LogElement> &, uint64_t) [LogElement = DB::TraceLogElement]: Failed to flush system log system.trace_log with 4 entries up to offset 4: std::exception. Code: 1001, type: std::__1::__fs::filesystem::filesystem_error, e.what() = filesystem error: in rename: Permission denied ["/var/lib/clickhouse/store/add/add330e9-37ea-4c50-8c6e-84a260a08d3e/tmp_insert_202408_1_1_0/"] ["/var/lib/clickhouse/store/add/add330e9-37ea-4c50-8c6e-84a260a08d3e/202408_1_1_0/"], Stack trace (when copying this message, always include the lines below):
0. std::system_error::system_error(std::error_code, String const&) @ 0x0000000017a13af5
1. std::__fs::filesystem::filesystem_error::filesystem_error[abi:v15000](String const&, std::__fs::filesystem::path const&, std::__fs::filesystem::path const&, std::error_code) @ 0x00000000179caba4
2. void std::__fs::filesystem::__throw_filesystem_error[abi:v15000]<String&, std::__fs::filesystem::path const&, std::__fs::filesystem::path const&, std::error_code const&>(String&, std::__fs::filesystem::path const&, std::__fs::filesystem::path const&, std::error_code const&) @ 0x00000000179ca97d
3. std::__fs::filesystem::detail::(anonymous namespace)::ErrorHandler<void>::report(std::error_code const&) const (.llvm.8065066547597231132) @ 0x00000000179ccc3a
4. std::__fs::filesystem::__rename(std::__fs::filesystem::path const&, std::__fs::filesystem::path const&, std::error_code*) @ 0x00000000179d0f9d
5. DB::DiskLocal::moveDirectory(String const&, String const&) @ 0x0000000010bd5ce9
6. DB::DataPartStorageOnDiskBase::rename(String, String, std::shared_ptr<Poco::Logger>, bool, bool) @ 0x0000000012429095
7. DB::IMergeTreeDataPart::renameTo(String const&, bool) @ 0x000000001245fd90
8. DB::MergeTreeData::renameTempPartAndReplaceImpl(std::shared_ptr<DB::IMergeTreeDataPart>&, DB::MergeTreeData::Transaction&, DB::DataPartsLock&, std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>>*) @ 0x000000001252bc38
9. DB::MergeTreeData::renameTempPartAndAdd(std::shared_ptr<DB::IMergeTreeDataPart>&, DB::MergeTreeData::Transaction&, DB::DataPartsLock&) @ 0x000000001252d7c5
10. DB::MergeTreeSink::finishDelayedChunk() @ 0x00000000128aa06c
11. DB::runStep(std::function<void ()>, DB::ThreadStatus*, std::atomic<unsigned long>*) @ 0x0000000012db144b
12. DB::ExceptionKeepingTransform::work() @ 0x0000000012db0c7b
13. DB::ExecutionThreadContext::executeTask() @ 0x0000000012b68047
14. DB::PipelineExecutor::executeStepImpl(unsigned long, std::atomic<bool>*) @ 0x0000000012b5c930
15. DB::PipelineExecutor::executeStep(std::atomic<bool>*) @ 0x0000000012b5c348
16. DB::SystemLog<DB::TraceLogElement>::savingThreadFunction() @ 0x000000001189bb3b
17. void std::__function::__policy_invoker<void ()>::__call_impl<std::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true, true>::ThreadFromGlobalPoolImpl<DB::SystemLogBase<DB::TraceLogElement>::startup()::'lambda'()>(DB::SystemLogBase<DB::TraceLogElement>::startup()::'lambda'()&&)::'lambda'(), void ()>>(std::__function::__policy_storage const*) @ 0x000000000d11e968
18. void* std::__thread_proxy[abi:v15000]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void ThreadPoolImpl<std::thread>::scheduleImpl<void>(std::function<void ()>, Priority, std::optional<unsigned long>, bool)::'lambda0'()>>(void*) @ 0x000000000d0d71a3
19. ? @ 0x00007f9becd49609
20. ? @ 0x00007f9becc64353
解决方法
换源、修改配置,都无法解决问题。找到以下网页,应该是同样的错误原因:
https://github.com/ClickHouse/ClickHouse/issues/35036
https://github.com/ClickHouse/ClickHouse/issues/56288
于是,回退到版本21.3.20.1,docker pull clickhouse/clickhouse-server:21.3.20.1
,运行成功。注意配置文件布局和最新版本略有不同,仍然需要打开监听<listen_host>0.0.0.0</listen_host>
等。否则curl localhost:8123
出现empty reply而不是Ok.
。
Python clickhouse_driver execute报错
问题描述
clickhouse_driver.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server 127.0.0.1:8123 (expected Hello or Exception, got Unknown packet)
解决方法
ClickHouse server provides two protocols for communication:
HTTP protocol (port 8123 by default);
Native (TCP) protocol (port 9000 by default).
Clickhouse-driver is designed to communicate with ClickHouse server from Python over native protocol.
应使用9000端口连接。
注:默认的用户名是default
,密码为空,默认的数据库是default
,使用指令SELECT * FROM system.databases;
查看。