Skip to content

Commit

Permalink
Add parameter ETCD_QUOTA_BYTES
Browse files Browse the repository at this point in the history
  • Loading branch information
Azrael-lol committed Jun 21, 2021
1 parent 65f4bf8 commit 86159e3
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 9 deletions.
1 change: 1 addition & 0 deletions ansible/files/etc/confd/templates/02.app.env.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DELETED_NODES_DESC_EOF
changedVariables=$(updateAndCompareFile /opt/app/bin/.env << APP_ENV_FILE
CLUSTER_ID={{ getv "/cluster/cluster_id" }}
ETCD_COMPACT_INTERVAL={{ getv "/env/etcautocompact" "0" }}
ETCD_QUOTA_BYTES={{ getv "/env/etcd.quota.backend.bytes" "2147483648" }}
MY_ROLE={{ $myRole }}
MY_SID={{ $mySid }}
MY_IP={{ getv "/host/ip" }}
Expand Down
2 changes: 1 addition & 1 deletion ansible/files/opt/app/bin/ctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ restart() {

update() {
svc is-enabled -q || return 0
[ "$MY_ROLE" = "etcd-proxy" ] || [[ ,${CHANGED_VARS// /,} =~ ,ETCD_COMPACT_INTERVAL= ]] || return 0
[ "$MY_ROLE" = "etcd-proxy" ] || [[ ,${CHANGED_VARS// /,} =~ ,ETCD_COMPACT_INTERVAL= ]] || [[ ,${CHANGED_VARS// /,} =~ ,ETCD_QUOTA_BYTES= ]] || return 0
restart
}

Expand Down
1 change: 1 addition & 0 deletions ansible/files/opt/app/bin/etcdutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ETCD_ADVERTISE_CLIENT_URLS=$(buildClientUrls)
ETCD_INITIAL_CLUSTER=${members// /,}
ETCD_INITIAL_CLUSTER_TOKEN=$etcdClusterToken
ETCD_AUTO_COMPACTION_RETENTION=$ETCD_COMPACT_INTERVAL
ETCD_QUOTA_BACKEND_BYTES=$ETCD_QUOTA_BYTES
ETCD_INITIAL_CLUSTER_STATE=$state
ETCD_ENV_FILE_EOF
}
Expand Down
13 changes: 13 additions & 0 deletions ansible/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@
vars:
etcdVersion: v3.2.24
etcdVersion2: v3.3.11
target_env: "{{ lookup('env', 'target') }}"
local_cache_path: "~/.ansible/cache"
# ansible_ssh_pass: Zhu1241jie
# ansible_python_interpreter: /usr/bin/python3
user: etcd

tasks:
- name: common setup
include_role:
name: "{{ service_name }}"
loop:
- disable-apt-jobs-1.0.0
- disable-motd-1.0.0
- app-agent-1.0.6
- arping-1.0.0
loop_control:
loop_var: service_name

- name: Add the Service Group
group:
name: "{{ user }}"
Expand Down
9 changes: 9 additions & 0 deletions ansible/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- src: https://qingcloudappcenter.github.io/ansible-roles/disable-apt-jobs-1.0.0.tar.gz
- src: https://qingcloudappcenter.github.io/ansible-roles/disable-motd-1.0.0.tar.gz
- src: https://qingcloudappcenter.github.io/ansible-roles/app-agent-1.0.6.tar.gz
- src: https://qingcloudappcenter.github.io/ansible-roles/appctl-1.2.2.tar.gz
- src: https://qingcloudappcenter.github.io/ansible-roles/arping-1.0.0.tar.gz
- src: https://qingcloudappcenter.github.io/ansible-roles/confd-files-1.0.8.tar.gz
- src: https://qingcloudappcenter.github.io/ansible-roles/install-1.0.5.tar.gz
- src: https://qingcloudappcenter.github.io/ansible-roles/caddy-1.1.7.tar.gz
- src: https://qingcloudappcenter.github.io/ansible-roles/create-service-user-1.0.0.tar.gz
13 changes: 7 additions & 6 deletions app/cluster.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"incremental_backup_supported": false,
"backup_policy": "device",
"advanced_actions": [ "scale_horizontal" ],
"upgrade_policy": [ "appv-yycc2fun" ],
"upgrade_policy": [ "appv-7izgt3gc" ],
"upgrading_policy": "sequential",
"multi_zone_policy": "round_robin",
"nodes": [{
"role": "etcd_node",
"container": {
"type": "kvm",
"zone": "pek3a",
"image": "img-7gi225x6"
"zone": "sh1",
"image": "img-l1sksi5f"
},
"count": {{cluster.etcd_node.count}},
"instance_class": {{cluster.etcd_node.instance_class}},
Expand Down Expand Up @@ -71,7 +71,8 @@
}
},
"env": {
"etcautocompact": {{env.etcd_node.autocompact}}
"etcautocompact": {{env.etcd_node.autocompact}},
"etcd.quota.backend.bytes": {{env.etcd_node.quotabytes}}
},
"monitor": {
"enable": true,
Expand Down Expand Up @@ -111,8 +112,8 @@
"role": "etcd_proxy",
"container": {
"type": "kvm",
"zone": "pek3a",
"image": "img-7gi225x6"
"zone": "sh1",
"image": "img-l1sksi5f"
},
"count": {{cluster.etcd_proxy.count}},
"instance_class": {{cluster.etcd_proxy.instance_class}},
Expand Down
12 changes: 11 additions & 1 deletion app/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,19 @@
"default": 0,
"min": 0,
"required": "yes"
},{
"key": "quotabytes",
"label": "etcd.quota.backend.bytes",
"description": "etcdquotabytesdescrip",
"type": "integer",
"changeable": true,
"default": 2147483648,
"min": 2147483648,
"max": 8589934592,
"required": "yes"
}]
}]
}, {
},{
"key": "service_params",
"description": "custom services parameters",
"type": "array",
Expand Down
3 changes: 2 additions & 1 deletion app/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
"Memory": "Memory",
"Count":"Count",
"VxNet": "Virtual private network",
"VolumeClassDes":"",
"InstanceClassDescrip":"The instance type for the cluster to run,such as high performance,high performance plus",
"InstanceClassLabel":"Instance Class",
"etcautocompact":"etcd autocompact",
"etcdautocompactdescrip":"etcd autocompact, 0 for disable",
"etcd.quota.backend.bytes": "etcd quota-backend-bytes",
"etcdquotabytesdescrip": "8GB is a suggested maximum size for normal environments and etcd warns at startup if the configured value exceeds it",
"VolumeClassDes":"The volume type for the cluster to run,such as high performance,high performance plus",
"VolumeClasslabel":"Volume Class",
"enableCorednsdescript":"Enable coredns server,please allocate at least one proxy node before enable coredns",
Expand Down
2 changes: 2 additions & 0 deletions app/locale/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"compact": "清理历史数据",
"etcautocompact": "etcd autocompact",
"etcdautocompactdescrip": "自动清理历史数据的时间间隔,单位是小时,比如 1 表示每隔一小时清理一次数据;默认为 0 表示不自动清除",
"etcd.quota.backend.bytes": "etcd quota-backend-bytes",
"etcdquotabytesdescrip": "存储大小限制,单位是字节,默认大小为2GB,建议最大值为8GB",
"repair": "修复",
"Source Node IP": "源节点 IP 地址",
"The node IP of etcd from which to take data": "使用源节点上的数据对集群做修复;注意:其他节点原有的数据将被抹除,修复完成后所有节点拥有与此节点相同的数据,如有疑惑请先提交工单获取协助",
Expand Down

0 comments on commit 86159e3

Please sign in to comment.