Skip to content

Commit

Permalink
fix(mongodb): 修复MongoDB2.4版本创建管理用户权限和完善MongoDB原子任务example文档 TencentBl…
Browse files Browse the repository at this point in the history
  • Loading branch information
yyhenryyy committed Jun 6, 2024
1 parent c355d80 commit ff5778a
Show file tree
Hide file tree
Showing 24 changed files with 634 additions and 119 deletions.
115 changes: 115 additions & 0 deletions dbm-services/go.work.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"port":27021,
"adminUsername":"xxx",
"adminPassword":"xxxxxxx",
"shard":{
"test-test1-s1":"1.1.1.2:27001,1.1.1.3:27002",
"test-test1-s2":"1.1.1.2:27004,1.1.1.3:27005",
"test-test1-s3":"1.1.1.3:27001,1.1.1.4:27002",
"test-test1-s4":"1.1.1.3:27004,1.1.1.4:27005"
"shards":{
"test1-s1":"1.1.1.2:27001,1.1.1.3:27002",
"test1-s2":"1.1.1.2:27004,1.1.1.3:27005",
"test1-s3":"1.1.1.3:27001,1.1.1.4:27002",
"test1-s4":"1.1.1.3:27004,1.1.1.4:27005"
}
}
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### mongod_replace
### cluster_balancer
初始化新机器:

```json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
```json
./dbactuator_redis --uid={{uid}} --root_id={{root_id}} --node_id={{node_id}} --version_id={{version_id}} --atom-job-list="init_replicaset" --payload='{{payload_base64}}'
```
--data_dir、--backup_dir 可以留空. --user启动进程用户名,--group启动进程用户名的属组,如果为空默认都为mysql。

原始payload

```json
{
"ip":"1.1.1.1",
"port":27001,
"app":"test",
"areaId":"test1",
"setId":"s1",
"configSvr":false,
"ips":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@
{
"ip":"1.1.1.1",
"port":27002,
"app":"test",
"areaId":"test1",
"setId":"test1",
"nodeInfo":[
"1.1.1.1",
"1.1.1.2"
],
"instanceType":"mongod"
"instanceType":"mongod",
"force": true,
"renameDir": true
}
```
"instanceType" 为mongod或mongos

"force" 为true时,会强制卸载,不检查是否有连接;为false时,会检查是否有连接

"renameDir" 为true时,会重命名目录;为false时,不会重命名目录
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"script":"xxx",
"type":"cluster",
"secondary": false,
"scriptName": "xxx",
"adminUsername":"xxx",
"adminPassword":"xxxxxx",
"repoUrl":"url",
Expand All @@ -27,4 +28,10 @@
}
```

"script" 为JavaScript脚本内容

"scriptName" 为脚本名称

"secondary" 为true时,表示在secondary节点执行;为false时,表示在primary节点执行

以repo为前缀的字段为制品库信息
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,33 @@
"ip":"1.1.1.1",
"port":27001,
"instanceType":"mongod",
"singleNodeInstallRestart":false,
"auth":true,
"cacheSizeGB": null,
"cacheSizeGB": 0,
"mongoSConfDbOld":"",
"MongoSConfDbNew":"",
"adminUsername":"",
"adminPassword":""
"adminUsername":"xxx",
"adminPassword":"xxx",
"onlyChangeParam": false
}
```
"singleNodeInstallRestart"字段表示安装替换节点时mongod单节点重启 true:替换节点单节点重启 false:复制集节点重启
"adminUsername"和"adminPassword"字段为空时表示安装时最后一步重启进程,不为空时表示提供服务期间重启
"cacheSizeGB" 为0,不改变大小

"onlyChangeParam" 为true,不重启mongod,仅修改配置文件;为false,既要修改配置文件,也要重启mongod

## mongos
```json
{
"ip":"1.1.1.1",
"port":27021,
"instanceType":"mongos",
"singleNodeInstallRestart":false,
"auth":true,
"cacheSizeGB": null,
"cacheSizeGB": 0,
"mongoSConfDbOld":"1.1.1.2:27001",
"MongoSConfDbNew":"1.1.1.2:27004",
"adminUsername":"",
"adminPassword":""
"adminPassword":"",
"onlyChangeParam": true
}
```
```

"onlyChangeParam" 为true,不重启mongos,仅修改配置文件;为false,既要修改配置文件,也要重启mongos
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### replace_package
初始化新机器:

```json
./dbactuator_redis --uid={{uid}} --root_id={{root_id}} --node_id={{node_id}} --version_id={{version_id}} --atom-job-list="replace_package" --payload='{{payload_base64}}'
```


原始payload

```json
{
"mediapkg": {
"pkg": "",
"pkg_md5": "xxx"
},
"ip":"1.1.1.1",
"port":27021,
"dbVersion":"3.4.20",
"instanceType": "mongod"
}
```

"instanceType" 为mongod或mongos
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### mongo_set_fcv
初始化新机器:

```json
./dbactuator_redis --uid={{uid}} --root_id={{root_id}} --node_id={{node_id}} --version_id={{version_id}} --atom-job-list="mongo_set_fcv" --payload='{{payload_base64}}'
```


原始payload

```json
{
"ip":"1.1.1.1",
"port":27021,
"oldFcv": "4.0",
"newFcv": "4.2",
"instanceType": "mongod",
"adminUsername":"xxx",
"adminPassword":"xxxxxxx",
}
```

"instanceType" 参数可选值: mongod, mongos
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### mongo_set_profiler
初始化新机器:

```json
./dbactuator_redis --uid={{uid}} --root_id={{root_id}} --node_id={{node_id}} --version_id={{version_id}} --atom-job-list="mongo_set_profiler" --data_dir=/path/to/data --backup_dir=/path/to/backup --user="xxx" --group="xxx" --payload='{{payload_base64}}'
```


原始payload

```json
{
"ip":"xxx",
"port":"xxxxxxx",
"dbName": "xxx",
"level": 2,
"profileSize": 4,
"adminUsername": "xxx",
"adminPassword": "xxx"
}
```

"level" 有三个级别,0关闭profiler,1记录超过慢语句阈值的语句,2记录所有的语句

"profileSize" 记录语句的集合大小
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### mongo_start
初始化新机器:

```json
./dbactuator_redis --uid={{uid}} --root_id={{root_id}} --node_id={{node_id}} --version_id={{version_id}} --atom-job-list="mongo_start" --payload='{{payload_base64}}'
```


原始payload

```json
{
"ip":"1.1.1.1",
"port":27021,
"instanceType":"mongod",
"auth": true
}
```

"instanceType" 参数可选值: mongod, mongos
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### mongod_change_oplogsize
初始化新机器:

```json
./dbactuator_redis --uid={{uid}} --root_id={{root_id}} --node_id={{node_id}} --version_id={{version_id}} --atom-job-list="mongod_change_oplogsize" --payload='{{payload_base64}}'
```


原始payload

```json
{
"ip":"1.1.1.1",
"port":27021,
"adminUsername":"xxx",
"adminPassword":"xxxxxxx",
"newOplogSize": 10
}
```

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
初始化新机器:

```json
./dbactuator_redis --uid={{uid}} --root_id={{root_id}} --node_id={{node_id}} --version_id={{version_id}} --atom-job-list="mongod_install" --data_dir=/path/to/data --backup_dir=/path/to/backup --user="xxx" --group="xxx" --payload='{{payload_base64}}'
./dbactuator_redis --uid={{uid}} --root_id={{root_id}} --node_id={{node_id}} --version_id={{version_id}} --atom-job-list="mongod_install" --data_dir=/path/to/data --backup_dir=/path/to/backup --payload='{{payload_base64}}'
```
--data_dir、--backup_dir 可以留空. --user启动进程用户名,--group启动进程用户名的属组,如果为空默认都为mysql。


原始payload

Expand All @@ -19,9 +19,8 @@
"port":27001,
"dbVersion":"3.4.20",
"instanceType":"mongod",
"app":"test",
"areaId":"test1",
"setId":"s1",
"keyFile": "xxx",
"auth": true,
"clusterRole":"shardsvr",
"dbConfig":{
Expand All @@ -45,9 +44,8 @@
"port":27002,
"dbVersion":"3.4.20",
"instanceType":"mongod",
"app":"test",
"areaId":"test1",
"setId":"conf",
"keyFile": "xxx",
"auth": true,
"clusterRole":"configsvr",
"dbConfig":{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"targetHidden":""
}
```

"sourceDown" 源端是否已down机
"targetPriority"可以指定替换节点的优先级
"targetHidden"可以指定替换节点是否为隐藏节点
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
```json
./dbactuator_redis --uid={{uid}} --root_id={{root_id}} --node_id={{node_id}} --version_id={{version_id}} --atom-job-list="mongos_install" --data_dir=/path/to/data --backup_dir=/path/to/backup --user="xxx" --group="xxx" --payload='{{payload_base64}}'
```
--data_dir、--backup_dir 可以留空. --user启动进程用户名,--group启动进程用户名的属组,如果为空默认都为mysql。


原始payload

Expand All @@ -18,8 +18,8 @@
"port":27021,
"dbVersion":"3.4.20",
"instanceType":"mongos",
"app":"test",
"areaId":"test1",
"setId": "s1",
"keyFile": "xxx",
"auth": true,
"configDB":["1.1.1.2:27001","1.1.1.3:27002","1.1.1.4:27003"],
"dbConfig":{
Expand Down
1 change: 1 addition & 0 deletions dbm-services/mongodb/db-tools/dbactuator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require (
replace go.mongodb.org/mongo-driver => go.mongodb.org/mongo-driver v1.10.6

require (
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions dbm-services/mongodb/db-tools/dbactuator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=
github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
Expand Down
Loading

0 comments on commit ff5778a

Please sign in to comment.