github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/apecloud-mysql/scripts/vttablet.sh (about) 1 #!/bin/bash 2 while [ "$KB_PROXY_ENABLED" != "on" ] 3 do 4 sleep 60 5 done 6 7 . /scripts/set_config_variables.sh 8 set_config_variables vttablet 9 10 cell=${CELL:-'zone1'} 11 uid="${KB_POD_NAME##*-}" 12 mysql_root=${MYSQL_ROOT_USER:-'root'} 13 mysql_root_passwd=${MYSQL_ROOT_PASSWORD:-'123456'} 14 mysql_port=${MYSQL_PORT:-'3306'} 15 port=${VTTABLET_PORT:-'15100'} 16 grpc_port=${VTTABLET_GRPC_PORT:-'16100'} 17 vtctld_host=${VTCTLD_HOST:-'127.0.0.1'} 18 vtctld_web_port=${VTCTLD_WEB_PORT:-'15000'} 19 printf -v alias '%s-%010d' $cell $uid 20 printf -v tablet_dir 'vt_%010d' $uid 21 tablet_hostname=$(eval echo \$KB_"$uid"_HOSTNAME) 22 printf -v tablet_logfile 'vttablet_%010d_querylog.txt' $uid 23 24 tablet_type=replica 25 topology_fags=${TOPOLOGY_FLAGS:-'--topo_implementation etcd2 --topo_global_server_address 127.0.0.1:2379 --topo_global_root /vitess/global'} 26 27 /scripts/wait-for-service.sh vtctld $vtctld_host $vtctld_web_port 28 29 echo "starting vttablet for $alias..." 30 31 VTDATAROOT=$VTDATAROOT/vttablet 32 su vitess <<EOF 33 mkdir -p $VTDATAROOT 34 exec vttablet \ 35 $topology_fags \ 36 --alsologtostderr \ 37 $(if [ "$enable_logs" == "true" ]; then echo "--log_dir $VTDATAROOT"; fi) \ 38 $(if [ "$enable_query_log" == "true" ]; then echo "--log_queries_to_file $VTDATAROOT/$tablet_logfile"; fi) \ 39 --tablet-path $alias \ 40 --tablet_hostname "$tablet_hostname" \ 41 --init_tablet_type $tablet_type \ 42 --health_check_interval $health_check_interval \ 43 --shard_sync_retry_delay $shard_sync_retry_delay \ 44 --remote_operation_timeout $remote_operation_timeout \ 45 --db_connect_timeout_ms $db_connect_timeout_ms \ 46 --enable_replication_reporter \ 47 --backup_storage_implementation file \ 48 --file_backup_storage_root $VTDATAROOT/backups \ 49 --port $port \ 50 --db_port $mysql_port \ 51 --db_host $tablet_hostname \ 52 --db_allprivs_user $mysql_root \ 53 --db_allprivs_password $mysql_root_passwd \ 54 --db_dba_user $mysql_root \ 55 --db_dba_password $mysql_root_passwd \ 56 --db_app_user $mysql_root \ 57 --db_app_password $mysql_root_passwd \ 58 --db_filtered_user $mysql_root \ 59 --db_filtered_password $mysql_root_passwd \ 60 --grpc_port $grpc_port \ 61 --service_map 'grpc-queryservice,grpc-tabletmanager,grpc-updatestream' \ 62 --pid_file $VTDATAROOT/vttablet.pid \ 63 --vtctld_addr http://$vtctld_host:$vtctld_web_port/ \ 64 --table-acl-config-mode=$table_acl_config_mode \ 65 --disable_active_reparents \ 66 $(if [ -n "$table_acl_config" ]; then echo "--table-acl-config $table_acl_config"; fi) \ 67 $(if [ "$queryserver_config_strict_table_acl" == "true" ]; then echo "--queryserver-config-strict-table-acl"; fi) \ 68 $(if [ "$enforce_tableacl_config" == "true" ]; then echo "--enforce-tableacl-config"; fi) \ 69 --table-acl-config-reload-interval $table_acl_config_reload_interval 70 EOF