From 86159e36fa2fb250b74b56ecd7d6b5eeef5a6203 Mon Sep 17 00:00:00 2001 From: mini-idea <2596691139@qq.com> Date: Mon, 21 Jun 2021 17:54:08 +0800 Subject: [PATCH] Add parameter ETCD_QUOTA_BYTES --- ansible/files/etc/confd/templates/02.app.env.tmpl | 1 + ansible/files/opt/app/bin/ctl.sh | 2 +- ansible/files/opt/app/bin/etcdutils.sh | 1 + ansible/make.yml | 13 +++++++++++++ ansible/requirements.yml | 9 +++++++++ app/cluster.json.mustache | 13 +++++++------ app/config.json | 12 +++++++++++- app/locale/en.json | 3 ++- app/locale/zh-cn.json | 2 ++ 9 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 ansible/requirements.yml diff --git a/ansible/files/etc/confd/templates/02.app.env.tmpl b/ansible/files/etc/confd/templates/02.app.env.tmpl index 6d54ef5..2a9e60c 100644 --- a/ansible/files/etc/confd/templates/02.app.env.tmpl +++ b/ansible/files/etc/confd/templates/02.app.env.tmpl @@ -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" }} diff --git a/ansible/files/opt/app/bin/ctl.sh b/ansible/files/opt/app/bin/ctl.sh index 5fe2ab2..af67630 100644 --- a/ansible/files/opt/app/bin/ctl.sh +++ b/ansible/files/opt/app/bin/ctl.sh @@ -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 } diff --git a/ansible/files/opt/app/bin/etcdutils.sh b/ansible/files/opt/app/bin/etcdutils.sh index c38f3ce..d740655 100644 --- a/ansible/files/opt/app/bin/etcdutils.sh +++ b/ansible/files/opt/app/bin/etcdutils.sh @@ -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 } diff --git a/ansible/make.yml b/ansible/make.yml index 27449ef..8f828b6 100644 --- a/ansible/make.yml +++ b/ansible/make.yml @@ -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 }}" diff --git a/ansible/requirements.yml b/ansible/requirements.yml new file mode 100644 index 0000000..f2a8e50 --- /dev/null +++ b/ansible/requirements.yml @@ -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 diff --git a/app/cluster.json.mustache b/app/cluster.json.mustache index cc6d8cf..ede5aea 100644 --- a/app/cluster.json.mustache +++ b/app/cluster.json.mustache @@ -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}}, @@ -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, @@ -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}}, diff --git a/app/config.json b/app/config.json index 2a868c2..38dbb2c 100644 --- a/app/config.json +++ b/app/config.json @@ -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", diff --git a/app/locale/en.json b/app/locale/en.json index 8dfdf7c..b7a97a5 100644 --- a/app/locale/en.json +++ b/app/locale/en.json @@ -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", diff --git a/app/locale/zh-cn.json b/app/locale/zh-cn.json index a8a3a13..379bf3f 100644 --- a/app/locale/zh-cn.json +++ b/app/locale/zh-cn.json @@ -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": "使用源节点上的数据对集群做修复;注意:其他节点原有的数据将被抹除,修复完成后所有节点拥有与此节点相同的数据,如有疑惑请先提交工单获取协助",