Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami][clickhouse] Fix ClickHouse bug on custom init/start script #72646

Conversation

Trungtin1011
Copy link
Contributor

@Trungtin1011 Trungtin1011 commented Sep 20, 2024

[bitnami][clickhouse] Correct ClickHouse behavior when user adds custom init/start script

Description of the change

In bitnami/clickhouse 24.8.4-debian-12-r0, when user tries to run custom init/start script (in my case - create a new Database). ClickHouse cannot execute that scripts and cause the container to crash.

clickhouse 04:03:51.42 INFO  ==> ** Starting ClickHouse setup **
clickhouse 04:03:51.45 INFO  ==> Copying mounted configuration from /bitnami/clickhouse/etc
cp: -r not specified; omitting directory '/bitnami/clickhouse/etc/conf.d/default/..data'
cp: -r not specified; omitting directory '/bitnami/clickhouse/etc/conf.d/extra-configmap/..data'
clickhouse 04:03:51.46 INFO  ==> Starting ClickHouse in background
clickhouse 04:03:56.47 INFO  ==> ClickHouse started successfully
clickhouse 04:03:56.47 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d
clickhouse 04:03:56.47 WARN  ==> Sourcing /docker-entrypoint-initdb.d/platform_init_script.sh as it is not executable by the current user, any error may cause initialization to fail
Received exception from server (version 24.8.4):
Code: 999. DB::Exception: Received from localhost:9000. Coordination::Exception. Coordination::Exception: All connection tries failed while connecting to ZooKeeper. nodes: 10.10.2.133:2181, 10.10.2.45:2181, 10.10.1.159:2181
Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 24.8.4.13 (official build)), 10.10.2.133:2181
Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 24.8.4.13 (official build)), 10.10.2.45:2181
Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 24.8.4.13 (official build)), 10.10.1.159:2181
Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 24.8.4.13 (official build)), 10.10.2.133:2181
Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 24.8.4.13 (official build)), 10.10.2.45:2181
Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 24.8.4.13 (official build)), 10.10.1.159:2181
Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 24.8.4.13 (official build)), 10.10.2.133:2181
Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 24.8.4.13 (official build)), 10.10.2.45:2181
Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 24.8.4.13 (official build)), 10.10.1.159:2181
. (KEEPER_EXCEPTION)
(query: CREATE DATABASE IF NOT EXISTS test ON CLUSTER default;)

Benefits

This code change will fix the bug on user's custom script run when ClickHouse cluster start.

This will help me a lots in my current works.

Possible drawbacks

I don't think there is any issue about this because this bug had appeared for a long time.

Applicable issues

  • This change will fix my issue: #29545

Additional information

I've test the code changes, which work as expected

clickhouse 02:17:37.92 INFO  ==> ** Starting ClickHouse setup **
clickhouse 02:17:37.95 INFO  ==> Copying mounted configuration from /bitnami/clickhouse/etc
clickhouse 02:17:37.97 INFO  ==> Starting ClickHouse in background
clickhouse 02:17:42.98 INFO  ==> ClickHouse started successfully
clickhouse 02:17:42.98 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d
clickhouse 02:17:42.98 WARN  ==> Sourcing /docker-entrypoint-initdb.d/platform_init_script.sh as it is not executable by the current user, any error may cause initialization to fail
chi-shard0-0.chi-headless.chi.svc.cluster.local 9000    0               2       0
chi-shard0-2.chi-headless.chi.svc.cluster.local 9000    0               1       0
chi-shard0-1.chi-headless.chi.svc.cluster.local 9000    0               0       0

clickhouse 02:17:59.74 INFO  ==> ** ClickHouse setup finished! **
clickhouse 02:17:59.75 INFO  ==> ** Starting ClickHouse **
Processing configuration file '/opt/bitnami/clickhouse/etc/config.xml'.
Merging configuration file '/opt/bitnami/clickhouse/etc/conf.d/00_default_overrides.xml'.
Merging configuration file '/opt/bitnami/clickhouse/etc/conf.d/platform_extra_overrides.xml'.

Copy link
Contributor

@andresbono andresbono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting this contribution! I left a question related to one of the changes in the PR. Could you please take a look?

@dgomezleon dgomezleon merged commit aaeb3f9 into bitnami:main Oct 3, 2024
35 checks passed
@Trungtin1011 Trungtin1011 deleted the correct_clickhouse_custom_scripts_behavior branch October 6, 2024 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clickhouse solved verify Execute verification workflow for these changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants