2020-09-24 08:35:16 +00:00
#!/bin/bash
# script allows to install configs for clickhouse server and clients required
# for testing (stateless and stateful tests)
set -x -e
DEST_SERVER_PATH = " ${ 1 :- /etc/clickhouse-server } "
DEST_CLIENT_PATH = " ${ 2 :- /etc/clickhouse-client } "
SRC_PATH = " $( cd " $( dirname " $0 " ) " >/dev/null 2>& 1 ; pwd -P ) "
2020-09-24 10:22:00 +00:00
echo " Going to install test configs from $SRC_PATH into $DEST_SERVER_PATH "
2020-09-24 08:35:16 +00:00
mkdir -p $DEST_SERVER_PATH /config.d/
mkdir -p $DEST_SERVER_PATH /users.d/
mkdir -p $DEST_CLIENT_PATH
2022-06-01 09:02:55 +00:00
ln -sf $SRC_PATH /config.d/zookeeper_write.xml $DEST_SERVER_PATH /config.d/
2023-11-30 02:56:31 +00:00
ln -sf $SRC_PATH /config.d/max_num_to_warn.xml $DEST_SERVER_PATH /config.d/
2020-09-29 18:55:06 +00:00
ln -sf $SRC_PATH /config.d/listen.xml $DEST_SERVER_PATH /config.d/
ln -sf $SRC_PATH /config.d/text_log.xml $DEST_SERVER_PATH /config.d/
2023-11-07 10:03:57 +00:00
ln -sf $SRC_PATH /config.d/blob_storage_log.xml $DEST_SERVER_PATH /config.d/
2020-09-29 18:55:06 +00:00
ln -sf $SRC_PATH /config.d/custom_settings_prefixes.xml $DEST_SERVER_PATH /config.d/
2022-05-06 23:37:23 +00:00
ln -sf $SRC_PATH /config.d/enable_access_control_improvements.xml $DEST_SERVER_PATH /config.d/
2020-09-29 18:55:06 +00:00
ln -sf $SRC_PATH /config.d/macros.xml $DEST_SERVER_PATH /config.d/
ln -sf $SRC_PATH /config.d/secure_ports.xml $DEST_SERVER_PATH /config.d/
ln -sf $SRC_PATH /config.d/clusters.xml $DEST_SERVER_PATH /config.d/
ln -sf $SRC_PATH /config.d/graphite.xml $DEST_SERVER_PATH /config.d/
2023-12-14 16:26:35 +00:00
ln -sf $SRC_PATH /config.d/graphite_alternative.xml $DEST_SERVER_PATH /config.d/
2020-09-29 18:55:06 +00:00
ln -sf $SRC_PATH /config.d/database_atomic.xml $DEST_SERVER_PATH /config.d/
2020-10-06 07:13:55 +00:00
ln -sf $SRC_PATH /config.d/max_concurrent_queries.xml $DEST_SERVER_PATH /config.d/
2021-08-20 14:12:42 +00:00
ln -sf $SRC_PATH /config.d/merge_tree_settings.xml $DEST_SERVER_PATH /config.d/
2022-08-11 13:27:00 +00:00
ln -sf $SRC_PATH /config.d/merge_tree_old_dirs_cleanup.xml $DEST_SERVER_PATH /config.d/
2020-11-05 20:04:34 +00:00
ln -sf $SRC_PATH /config.d/test_cluster_with_incorrect_pw.xml $DEST_SERVER_PATH /config.d/
2021-03-29 08:24:56 +00:00
ln -sf $SRC_PATH /config.d/keeper_port.xml $DEST_SERVER_PATH /config.d/
2020-11-18 21:55:37 +00:00
ln -sf $SRC_PATH /config.d/logging_no_rotate.xml $DEST_SERVER_PATH /config.d/
2021-08-13 11:27:55 +00:00
ln -sf $SRC_PATH /config.d/merge_tree.xml $DEST_SERVER_PATH /config.d/
2023-06-20 21:53:32 +00:00
ln -sf $SRC_PATH /config.d/lost_forever_check.xml $DEST_SERVER_PATH /config.d/
2020-12-07 20:36:47 +00:00
ln -sf $SRC_PATH /config.d/tcp_with_proxy.xml $DEST_SERVER_PATH /config.d/
2022-08-05 12:06:34 +00:00
ln -sf $SRC_PATH /config.d/prometheus.xml $DEST_SERVER_PATH /config.d/
2020-12-03 21:11:38 +00:00
ln -sf $SRC_PATH /config.d/top_level_domains_lists.xml $DEST_SERVER_PATH /config.d/
2020-12-08 20:58:27 +00:00
ln -sf $SRC_PATH /config.d/top_level_domains_path.xml $DEST_SERVER_PATH /config.d/
2021-05-31 18:28:36 +00:00
ln -sf $SRC_PATH /config.d/transactions.xml $DEST_SERVER_PATH /config.d/
2021-07-30 09:12:33 +00:00
ln -sf $SRC_PATH /config.d/encryption.xml $DEST_SERVER_PATH /config.d/
2021-09-29 15:54:04 +00:00
ln -sf $SRC_PATH /config.d/CORS.xml $DEST_SERVER_PATH /config.d/
2021-07-09 14:05:35 +00:00
ln -sf $SRC_PATH /config.d/zookeeper_log.xml $DEST_SERVER_PATH /config.d/
2023-07-21 11:54:10 +00:00
ln -sf $SRC_PATH /config.d/logger_trace.xml $DEST_SERVER_PATH /config.d/
2021-10-06 12:06:40 +00:00
ln -sf $SRC_PATH /config.d/named_collection.xml $DEST_SERVER_PATH /config.d/
2022-05-01 10:59:19 +00:00
ln -sf $SRC_PATH /config.d/ssl_certs.xml $DEST_SERVER_PATH /config.d/
2022-05-01 11:46:55 +00:00
ln -sf $SRC_PATH /config.d/filesystem_cache_log.xml $DEST_SERVER_PATH /config.d/
2022-05-17 20:53:17 +00:00
ln -sf $SRC_PATH /config.d/session_log.xml $DEST_SERVER_PATH /config.d/
2022-08-19 05:59:13 +00:00
ln -sf $SRC_PATH /config.d/system_unfreeze.xml $DEST_SERVER_PATH /config.d/
2022-08-28 13:46:11 +00:00
ln -sf $SRC_PATH /config.d/enable_zero_copy_replication.xml $DEST_SERVER_PATH /config.d/
2022-08-26 20:36:34 +00:00
ln -sf $SRC_PATH /config.d/nlp.xml $DEST_SERVER_PATH /config.d/
2023-06-15 13:49:49 +00:00
ln -sf $SRC_PATH /config.d/forbidden_headers.xml $DEST_SERVER_PATH /config.d/
2022-09-02 13:12:02 +00:00
ln -sf $SRC_PATH /config.d/enable_keeper_map.xml $DEST_SERVER_PATH /config.d/
2022-10-21 21:27:21 +00:00
ln -sf $SRC_PATH /config.d/custom_disks_base_path.xml $DEST_SERVER_PATH /config.d/
2022-11-07 10:53:36 +00:00
ln -sf $SRC_PATH /config.d/display_name.xml $DEST_SERVER_PATH /config.d/
2023-01-30 15:04:37 +00:00
ln -sf $SRC_PATH /config.d/reverse_dns_query_function.xml $DEST_SERVER_PATH /config.d/
2022-11-18 14:54:22 +00:00
ln -sf $SRC_PATH /config.d/compressed_marks_and_index.xml $DEST_SERVER_PATH /config.d/
2023-03-31 09:12:41 +00:00
ln -sf $SRC_PATH /config.d/disable_s3_env_credentials.xml $DEST_SERVER_PATH /config.d/
2023-07-06 15:15:26 +00:00
ln -sf $SRC_PATH /config.d/enable_wait_for_shutdown_replicated_tables.xml $DEST_SERVER_PATH /config.d/
2023-03-30 17:06:49 +00:00
ln -sf $SRC_PATH /config.d/backups.xml $DEST_SERVER_PATH /config.d/
2023-08-20 08:36:04 +00:00
ln -sf $SRC_PATH /config.d/filesystem_caches_path.xml $DEST_SERVER_PATH /config.d/
2023-08-29 08:59:49 +00:00
ln -sf $SRC_PATH /config.d/validate_tcp_client_information.xml $DEST_SERVER_PATH /config.d/
2023-12-15 14:23:23 +00:00
ln -sf $SRC_PATH /config.d/zero_copy_destructive_operations.xml $DEST_SERVER_PATH /config.d/
2024-01-29 12:19:46 +00:00
ln -sf $SRC_PATH /config.d/block_number.xml $DEST_SERVER_PATH /config.d/
2022-05-01 11:46:55 +00:00
2022-08-28 01:56:35 +00:00
# Not supported with fasttest.
2022-09-27 22:57:47 +00:00
if [ " ${ DEST_SERVER_PATH } " = "/etc/clickhouse-server" ]
2022-08-28 01:56:35 +00:00
then
ln -sf $SRC_PATH /config.d/legacy_geobase.xml $DEST_SERVER_PATH /config.d/
fi
2022-05-01 11:46:55 +00:00
2020-09-29 18:55:06 +00:00
ln -sf $SRC_PATH /users.d/log_queries.xml $DEST_SERVER_PATH /users.d/
ln -sf $SRC_PATH /users.d/readonly.xml $DEST_SERVER_PATH /users.d/
ln -sf $SRC_PATH /users.d/access_management.xml $DEST_SERVER_PATH /users.d/
2020-10-13 14:29:24 +00:00
ln -sf $SRC_PATH /users.d/database_atomic_drop_detach_sync.xml $DEST_SERVER_PATH /users.d/
2020-11-19 15:58:33 +00:00
ln -sf $SRC_PATH /users.d/opentelemetry.xml $DEST_SERVER_PATH /users.d/
2021-03-03 20:32:53 +00:00
ln -sf $SRC_PATH /users.d/remote_queries.xml $DEST_SERVER_PATH /users.d/
2021-03-05 14:57:16 +00:00
ln -sf $SRC_PATH /users.d/session_log_test.xml $DEST_SERVER_PATH /users.d/
2021-10-15 14:04:31 +00:00
ln -sf $SRC_PATH /users.d/memory_profiler.xml $DEST_SERVER_PATH /users.d/
2021-10-13 20:43:38 +00:00
ln -sf $SRC_PATH /users.d/no_fsync_metadata.xml $DEST_SERVER_PATH /users.d/
2021-11-29 13:13:20 +00:00
ln -sf $SRC_PATH /users.d/filelog.xml $DEST_SERVER_PATH /users.d/
2022-08-23 13:12:09 +00:00
ln -sf $SRC_PATH /users.d/enable_blobs_check.xml $DEST_SERVER_PATH /users.d/
2022-09-12 10:48:47 +00:00
ln -sf $SRC_PATH /users.d/marks.xml $DEST_SERVER_PATH /users.d/
2022-11-10 12:14:04 +00:00
ln -sf $SRC_PATH /users.d/insert_keeper_retries.xml $DEST_SERVER_PATH /users.d/
2023-02-07 17:50:31 +00:00
ln -sf $SRC_PATH /users.d/prefetch_settings.xml $DEST_SERVER_PATH /users.d/
2023-06-13 14:02:54 +00:00
ln -sf $SRC_PATH /users.d/nonconst_timezone.xml $DEST_SERVER_PATH /users.d/
2023-11-11 04:52:44 +00:00
ln -sf $SRC_PATH /users.d/allow_introspection_functions.yaml $DEST_SERVER_PATH /users.d/
2023-11-29 12:44:49 +00:00
ln -sf $SRC_PATH /users.d/replicated_ddl_entry.xml $DEST_SERVER_PATH /users.d/
2020-09-29 18:55:06 +00:00
2023-04-12 15:18:28 +00:00
if [ [ -n " $USE_NEW_ANALYZER " ] ] && [ [ " $USE_NEW_ANALYZER " -eq 1 ] ] ; then
ln -sf $SRC_PATH /users.d/analyzer.xml $DEST_SERVER_PATH /users.d/
fi
2021-06-21 17:29:32 +00:00
# FIXME DataPartsExchange may hang for http_send_timeout seconds
# when nobody is going to read from the other side of socket (due to "Fetching of part was cancelled"),
# but socket is owned by HTTPSessionPool, so it's not closed.
ln -sf $SRC_PATH /users.d/timeouts.xml $DEST_SERVER_PATH /users.d/
2020-09-29 18:55:06 +00:00
ln -sf $SRC_PATH /ints_dictionary.xml $DEST_SERVER_PATH /
ln -sf $SRC_PATH /strings_dictionary.xml $DEST_SERVER_PATH /
ln -sf $SRC_PATH /decimals_dictionary.xml $DEST_SERVER_PATH /
ln -sf $SRC_PATH /executable_dictionary.xml $DEST_SERVER_PATH /
2021-03-01 13:57:47 +00:00
ln -sf $SRC_PATH /executable_pool_dictionary.xml $DEST_SERVER_PATH /
2021-09-13 14:47:38 +00:00
ln -sf $SRC_PATH /test_function.xml $DEST_SERVER_PATH /
2020-09-29 18:55:06 +00:00
2020-12-08 20:58:27 +00:00
ln -sf $SRC_PATH /top_level_domains $DEST_SERVER_PATH /
2022-08-26 23:54:45 +00:00
ln -sf $SRC_PATH /regions_hierarchy.txt $DEST_SERVER_PATH /config.d/
ln -sf $SRC_PATH /regions_names_en.txt $DEST_SERVER_PATH /config.d/
2020-12-03 21:11:38 +00:00
2022-08-26 23:56:56 +00:00
ln -sf $SRC_PATH /ext-en.txt $DEST_SERVER_PATH /config.d/
ln -sf $SRC_PATH /ext-ru.txt $DEST_SERVER_PATH /config.d/
ln -sf $SRC_PATH /lem-en.bin $DEST_SERVER_PATH /config.d/
2022-08-26 20:36:34 +00:00
2020-09-29 18:55:06 +00:00
ln -sf $SRC_PATH /server.key $DEST_SERVER_PATH /
ln -sf $SRC_PATH /server.crt $DEST_SERVER_PATH /
ln -sf $SRC_PATH /dhparam.pem $DEST_SERVER_PATH /
2020-09-24 08:35:16 +00:00
# Retain any pre-existing config and allow ClickHouse to load it if required
2020-09-29 18:55:06 +00:00
ln -sf --backup= simple --suffix= _original.xml \
2020-09-24 10:22:00 +00:00
$SRC_PATH /config.d/query_masking_rules.xml $DEST_SERVER_PATH /config.d/
2020-09-24 08:35:16 +00:00
2021-10-21 13:59:13 +00:00
if [ [ -n " $ZOOKEEPER_FAULT_INJECTION " ] ] && [ [ " $ZOOKEEPER_FAULT_INJECTION " -eq 1 ] ] ; then
2022-12-28 13:29:27 +00:00
rm -f $DEST_SERVER_PATH /config.d/zookeeper.xml || :
2021-10-21 13:59:13 +00:00
ln -sf $SRC_PATH /config.d/zookeeper_fault_injection.xml $DEST_SERVER_PATH /config.d/
else
2022-12-28 13:29:27 +00:00
rm -f $DEST_SERVER_PATH /config.d/zookeeper_fault_injection.xml || :
2021-10-21 13:59:13 +00:00
ln -sf $SRC_PATH /config.d/zookeeper.xml $DEST_SERVER_PATH /config.d/
fi
2022-08-03 11:43:30 +00:00
# We randomize creating the snapshot on exit for Keeper to test out using older snapshots
2023-09-22 13:47:28 +00:00
value = $(( $RANDOM % 2 ))
sed --follow-symlinks -i " s|<create_snapshot_on_exit>[01]</create_snapshot_on_exit>|<create_snapshot_on_exit> $value </create_snapshot_on_exit>| " $DEST_SERVER_PATH /config.d/keeper_port.xml
2022-08-03 11:43:30 +00:00
2020-09-24 08:35:16 +00:00
if [ [ -n " $USE_POLYMORPHIC_PARTS " ] ] && [ [ " $USE_POLYMORPHIC_PARTS " -eq 1 ] ] ; then
2020-09-29 18:55:06 +00:00
ln -sf $SRC_PATH /config.d/polymorphic_parts.xml $DEST_SERVER_PATH /config.d/
2020-09-24 08:35:16 +00:00
fi
2020-09-24 23:04:01 +00:00
if [ [ -n " $USE_DATABASE_ORDINARY " ] ] && [ [ " $USE_DATABASE_ORDINARY " -eq 1 ] ] ; then
2020-09-29 18:55:06 +00:00
ln -sf $SRC_PATH /users.d/database_ordinary.xml $DEST_SERVER_PATH /users.d/
2020-09-24 08:35:16 +00:00
fi
2022-03-01 10:57:14 +00:00
if [ [ -n " $USE_S3_STORAGE_FOR_MERGE_TREE " ] ] && [ [ " $USE_S3_STORAGE_FOR_MERGE_TREE " -eq 1 ] ] ; then
2024-01-03 15:15:56 +00:00
object_key_types_options = ( "generate-suffix" "generate-full-key" "generate-template-key" )
2024-01-04 17:11:00 +00:00
object_key_type = " ${ object_key_types_options [0] } "
2024-01-03 15:15:56 +00:00
if [ [ -n " $RANDOMIZE_OBJECT_KEY_TYPE " ] ] && [ [ " $RANDOMIZE_OBJECT_KEY_TYPE " -eq 1 ] ] ; then
2024-01-04 17:11:00 +00:00
object_key_type = " ${ object_key_types_options [ $(( $RANDOM % ${# object_key_types_options [@] } )) ] } "
2024-01-03 15:15:56 +00:00
fi
2024-01-04 21:45:57 +00:00
case $object_key_type in
2024-01-02 18:59:59 +00:00
"generate-full-key" )
ln -sf $SRC_PATH /config.d/storage_metadata_with_full_object_key.xml $DEST_SERVER_PATH /config.d/
2024-01-10 19:50:20 +00:00
ln -sf $SRC_PATH /config.d/s3_storage_policy_by_default.xml $DEST_SERVER_PATH /config.d/
2024-01-02 18:59:59 +00:00
; ;
"generate-template-key" )
ln -sf $SRC_PATH /config.d/storage_metadata_with_full_object_key.xml $DEST_SERVER_PATH /config.d/
2024-01-12 09:36:25 +00:00
ln -sf $SRC_PATH /config.d/s3_storage_policy_with_template_object_key.xml $DEST_SERVER_PATH /config.d/s3_storage_policy_by_default.xml
2024-01-02 18:59:59 +00:00
; ;
"generate-suffix" | *)
ln -sf $SRC_PATH /config.d/s3_storage_policy_by_default.xml $DEST_SERVER_PATH /config.d/
; ;
esac
2022-03-01 10:57:14 +00:00
fi
2022-08-08 08:37:58 +00:00
ARM = "aarch64"
OS = " $( uname -m) "
2022-03-01 10:57:14 +00:00
if [ [ -n " $EXPORT_S3_STORAGE_POLICIES " ] ] ; then
2022-08-08 08:37:58 +00:00
echo " $OS "
2022-08-15 22:58:09 +00:00
if [ [ " $USE_DATABASE_REPLICATED " -eq 1 ] ] || [ [ " $OS " = = " $ARM " ] ] ; then
echo "Azure configuration will not be added"
else
2022-08-08 08:37:58 +00:00
echo "Adding azure configuration"
2022-08-07 12:05:09 +00:00
ln -sf $SRC_PATH /config.d/azure_storage_conf.xml $DEST_SERVER_PATH /config.d/
fi
2022-03-01 10:57:14 +00:00
ln -sf $SRC_PATH /config.d/storage_conf.xml $DEST_SERVER_PATH /config.d/
2023-12-18 16:23:41 +00:00
ln -sf $SRC_PATH /config.d/storage_conf_02944.xml $DEST_SERVER_PATH /config.d/
2024-01-11 14:53:35 +00:00
ln -sf $SRC_PATH /config.d/storage_conf_02963.xml $DEST_SERVER_PATH /config.d/
2022-04-04 12:00:27 +00:00
ln -sf $SRC_PATH /users.d/s3_cache.xml $DEST_SERVER_PATH /users.d/
2023-10-19 09:23:56 +00:00
ln -sf $SRC_PATH /users.d/s3_cache_new.xml $DEST_SERVER_PATH /users.d/
2022-03-01 10:57:14 +00:00
fi
2021-02-15 10:26:34 +00:00
if [ [ -n " $USE_DATABASE_REPLICATED " ] ] && [ [ " $USE_DATABASE_REPLICATED " -eq 1 ] ] ; then
ln -sf $SRC_PATH /users.d/database_replicated.xml $DEST_SERVER_PATH /users.d/
2021-03-13 01:25:13 +00:00
ln -sf $SRC_PATH /config.d/database_replicated.xml $DEST_SERVER_PATH /config.d/
rm /etc/clickhouse-server/config.d/zookeeper.xml
2021-03-29 20:04:50 +00:00
rm /etc/clickhouse-server/config.d/keeper_port.xml
2021-03-13 10:22:48 +00:00
# There is a bug in config reloading, so we cannot override macros using --macros.replica r2
# And we have to copy configs...
2021-04-07 20:00:14 +00:00
mkdir -p /etc/clickhouse-server1
mkdir -p /etc/clickhouse-server2
2021-03-18 12:49:31 +00:00
chown clickhouse /etc/clickhouse-server1
2021-03-13 10:22:48 +00:00
chown clickhouse /etc/clickhouse-server2
2021-03-18 12:49:31 +00:00
chgrp clickhouse /etc/clickhouse-server1
2021-03-13 10:22:48 +00:00
chgrp clickhouse /etc/clickhouse-server2
2021-03-18 12:49:31 +00:00
sudo -u clickhouse cp -r /etc/clickhouse-server/* /etc/clickhouse-server1
2021-03-13 10:22:48 +00:00
sudo -u clickhouse cp -r /etc/clickhouse-server/* /etc/clickhouse-server2
2023-10-20 18:02:20 +00:00
2021-03-18 12:49:31 +00:00
rm /etc/clickhouse-server1/config.d/macros.xml
2021-03-13 10:22:48 +00:00
rm /etc/clickhouse-server2/config.d/macros.xml
2021-03-18 12:49:31 +00:00
sudo -u clickhouse cat /etc/clickhouse-server/config.d/macros.xml | sed "s|<replica>r1</replica>|<replica>r2</replica>|" > /etc/clickhouse-server1/config.d/macros.xml
sudo -u clickhouse cat /etc/clickhouse-server/config.d/macros.xml | sed "s|<shard>s1</shard>|<shard>s2</shard>|" > /etc/clickhouse-server2/config.d/macros.xml
2021-03-13 10:22:48 +00:00
2023-10-20 18:02:20 +00:00
rm /etc/clickhouse-server1/config.d/transactions.xml
rm /etc/clickhouse-server2/config.d/transactions.xml
sudo -u clickhouse cat /etc/clickhouse-server/config.d/transactions.xml | sed "s|/test/clickhouse/txn|/test/clickhouse/txn1|" > /etc/clickhouse-server1/config.d/transactions.xml
sudo -u clickhouse cat /etc/clickhouse-server/config.d/transactions.xml | sed "s|/test/clickhouse/txn|/test/clickhouse/txn2|" > /etc/clickhouse-server2/config.d/transactions.xml
2021-04-07 20:00:14 +00:00
sudo mkdir -p /var/lib/clickhouse1
sudo mkdir -p /var/lib/clickhouse2
2021-03-18 12:49:31 +00:00
sudo chown clickhouse /var/lib/clickhouse1
2021-03-13 10:22:48 +00:00
sudo chown clickhouse /var/lib/clickhouse2
2021-03-18 12:49:31 +00:00
sudo chgrp clickhouse /var/lib/clickhouse1
2021-03-13 10:22:48 +00:00
sudo chgrp clickhouse /var/lib/clickhouse2
2021-02-15 10:26:34 +00:00
fi
2020-09-24 08:35:16 +00:00
ln -sf $SRC_PATH /client_config.xml $DEST_CLIENT_PATH /config.xml