-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
2,057 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. | ||
Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at https://opensource.org/licenses/MIT | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
""" | ||
|
||
# 云区域容器化改造 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM mirrors.tencent.com/build/blueking/dbmedium:latest as medium | ||
|
||
FROM debian:bookworm-slim | ||
|
||
# 更新包列表并安装 cron 和 gettext-base | ||
RUN apt-get update && \ | ||
apt-get install -y jq gettext-base curl && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
## 获取dns介质文件 | ||
COPY --from=medium /app/medium/cloud/cloud-dbha/*/dbha /data/install/ | ||
COPY ./start.bash ./dbha-conf-tpl.yaml /data/install/ | ||
|
||
WORKDIR /data/install | ||
|
||
RUN chmod +x start.bash | ||
|
||
## 启动dbha服务 | ||
ENTRYPOINT ["/bin/bash", "-c", "/data/install/start.bash"] |
123 changes: 123 additions & 0 deletions
123
dbm-ui/backend/db_proxy/container/dbha/dbha-conf-tpl.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
log_conf: | ||
log_path: "./log" | ||
log_level: "LOG_DEBUG" | ||
log_maxsize: 512 | ||
log_maxbackups: 100 | ||
log_maxage: 30 | ||
log_compress: true | ||
agent_conf: | ||
active_db_type: [ | ||
"riak", | ||
"tendbha", | ||
"tendbcluster", | ||
"TwemproxyRedisInstance", | ||
"PredixyTendisplusCluster", | ||
"TwemproxyTendisSSDInstance" | ||
] | ||
city_id: -1 | ||
campus: "all" | ||
cloud_id: 0 | ||
fetch_interval: 60 | ||
reporter_interval: 120 | ||
local_ip: "$NODE_IP" | ||
gm_conf: | ||
city_id: 0 | ||
campus: "zero" | ||
cloud_id: 0 | ||
liston_port: 50000 | ||
local_ip: "$NODE_IP" | ||
report_interval: 60 | ||
GDM: | ||
dup_expire: 600 | ||
scan_interval: 1 | ||
GMM: | ||
GQA: | ||
idc_cache_expire: 300 | ||
single_switch_idc: 50 | ||
single_switch_interval: 86400 | ||
single_switch_limit: 48 | ||
all_host_switch_limit: 150 | ||
all_switch_interval: 7200 | ||
GCM: | ||
allowed_checksum_max_offset: 2 | ||
allowed_slave_delay_max: 600 | ||
allowed_time_delay_max: 300 | ||
exec_slow_kbytes: 0 | ||
password_conf: | ||
host: "$BK_DBM_URL" | ||
port: 80 | ||
url_pre: "/apis/proxypass" | ||
timeout: 10 | ||
bk_conf: | ||
bk_token: "$DB_CLOUD_TOKEN" | ||
db_conf: | ||
hadb: | ||
host: "$HADB_URL" | ||
port: 8080 | ||
timeout: 120 | ||
cmdb: | ||
host: "$BK_DBM_URL" | ||
port: 80 | ||
url_pre: "/apis/proxypass" | ||
timeout: 30 | ||
bk_conf: | ||
bk_token: "$DB_CLOUD_TOKEN" | ||
mysql: | ||
user: "$DBHA_USER" | ||
pass: "$DBHA_PASSWORD" | ||
proxy_user: "proxy" | ||
proxy_pass: "$DBHA_PROXY_PASSWORD" | ||
timeout: 10 | ||
redis: | ||
timeout: 10 | ||
riak: | ||
timeout: 10 | ||
name_services: | ||
dns_conf: | ||
host: "$BK_DBM_URL" | ||
port: 80 | ||
url_pre: "/apis/proxypass" | ||
user: "dbha" | ||
pass: "xxx" | ||
timeout: 10 | ||
bk_conf: | ||
bk_token: "$DB_CLOUD_TOKEN" | ||
remote_conf: | ||
host: "$BK_DBM_URL" | ||
port: 80 | ||
url_pre: "/apis/proxypass" | ||
user: "dbha" | ||
pass: "xxx" | ||
timeout: 10 | ||
bk_conf: | ||
bk_token: "$DB_CLOUD_TOKEN" | ||
polaris_conf: | ||
host: "$BK_DBM_URL" | ||
port: 80 | ||
user: "nouser" | ||
pass: "nopasswd" | ||
url_pre: "/apis/proxypass/nameservice" | ||
timeout: 10 | ||
bk_conf: | ||
bk_token: "$DB_CLOUD_TOKEN" | ||
clb_conf: | ||
host: "$BK_DBM_URL" | ||
port: 80 | ||
user: "nouser" | ||
pass: "nopasswd" | ||
url_pre: "/apis/proxypass/nameservice" | ||
timeout: 10 | ||
bk_conf: | ||
bk_token: "$DB_CLOUD_TOKEN" | ||
monitor: | ||
bk_data_id: $BKMONITOR_EVENT_DATA_ID | ||
access_token: "$BKMONITOR_EVENT_TOKEN" | ||
beat_path: "$MYSQL_CROND_BEAT_PATH" | ||
agent_address: "$MYSQL_CROND_AGENT_ADDRESS" | ||
local_ip: "$NODE_IP" | ||
ssh: | ||
port: 36000 | ||
user: "mysql" | ||
pass: "$MYSQL_OS_PASSWORD" | ||
dest: "agent" | ||
timeout: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 写入dbha记录 | ||
data=$( | ||
curl -XPOST "$BK_DBM_URL/apis/proxypass/cloud/insert/" \ | ||
--header "Content-Type: application/json" \ | ||
--data-raw '{ | ||
"bk_cloud_id": 0, | ||
"extension": "DBHA", | ||
"db_cloud_token": "'"$DB_CLOUD_TOKEN"'", | ||
"details": { | ||
"ip": "%", | ||
"dbha_type": "'"$DBHA_TYPE"'", | ||
"bk_city_code": "'"$DBHA_CITY"'", | ||
"bk_city_name": "'"$DBHA_CAMPUS"'", | ||
"bk_host_id": 0, | ||
"bk_cloud_id": 0 | ||
} | ||
}' | ||
) | ||
|
||
# 导出密码环境变量 | ||
export DBHA_USER=$(echo $data | jq -r '.data.dbha_account.user') | ||
export DBHA_PASSWORD=$(echo $data | jq -r '.data.dbha_account.password') | ||
export DBHA_PROXY_PASSWORD=$(echo $data | jq -r '.data.proxy_password') | ||
export MYSQL_OS_PASSWORD=$(echo $data | jq -r '.data.mysql_os_password') | ||
# 导出监控环境变量 | ||
export BKMONITOR_EVENT_DATA_ID=$(echo $data | jq -r '.data.bkm_dbm_report.event.data_id') | ||
export BKMONITOR_EVENT_TOKEN=$(echo $data | jq -r '.data.bkm_dbm_report.event.token') | ||
|
||
# 配置文件注入环境变量,启动dbha服务 | ||
touch log | ||
envsubst < ./dbha-conf-tpl.yaml > ./dbha.conf | ||
nohup ./dbha -config_file=dbha.conf -type=$DBHA_TYPE -> dbha-apply.log 2>&1 & | ||
tail -f log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM mirrors.tencent.com/build/blueking/dbmedium:latest as medium | ||
|
||
FROM debian:bookworm-slim | ||
|
||
# 更新包列表并安装 cron 和 gettext-base | ||
RUN apt-get update && \ | ||
apt-get install -y jq cron gettext-base curl && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
## 获取dns介质文件 | ||
COPY --from=medium /app/medium/cloud/cloud-dns-bind/*/bind.tar.gz /data/install/ | ||
COPY --from=medium /app/medium/cloud/cloud-dns-pullcrond/*/pull-crond /data/install/ | ||
COPY ./start.bash ./pull-crond.conf /data/install/ | ||
|
||
WORKDIR /data/install | ||
|
||
RUN chmod +x start.bash | ||
|
||
## 启动dns服务 | ||
ENTRYPOINT ["/bin/bash", "-c", "/data/install/start.bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
info_log_path="../log/info.log" | ||
error_log_path="../log/err.log" | ||
|
||
db_cloud_token="$DB_CLOUD_TOKEN" | ||
bk_dns_api_url="$BK_DBM_URL" | ||
bk_cloud_id=0 | ||
|
||
data_id="$BKMONITOR_EVENT_DATA_ID" | ||
access_token="$BKMONITOR_EVENT_TOKEN" | ||
bkmonitorbeat="$MYSQL_CROND_BEAT_PATH" | ||
agent_address="$MYSQL_CROND_AGENT_ADDRESS" | ||
local_ip="" | ||
|
||
interval="3" | ||
flush_switch="true" | ||
forward_ip="$NODE_IP;" | ||
|
||
options_named_file="/usr/local/bind/etc/named.conf" | ||
options_named_file_tpl="/usr/local/bind/etc/named.conf_tpl" | ||
local_named_file="/usr/local/bind/etc/named.conf.local" | ||
zone_dir_path="/usr/local/bind/var/run/named/" | ||
rndc="/usr/local/bind/sbin/rndc" | ||
rndc_config="/usr/local/bind/etc/rndc.conf" |
Oops, something went wrong.