This is an automated email from the ASF dual-hosted git repository.
zhaojinchao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git
The following commit(s) were added to refs/heads/main by this push:
new d82234b feat(cloudformation): add support for multi-az mode for
cloudformation. (#111)
d82234b is described below
commit d82234bb84935c2e6871471779736cc6c9b04bac
Author: pierce <[email protected]>
AuthorDate: Thu Nov 24 17:57:20 2022 +0800
feat(cloudformation): add support for multi-az mode for cloudformation.
(#111)
* feat(cloudformation): add support for multi-az mode for cloudformation.
Signed-off-by: xuanyuan300 <[email protected]>
* chore(cloudformation): add license for cf.json
Signed-off-by: xuanyuan300 <[email protected]>
* chore(cloudformation): add license, update parameter description
Signed-off-by: xuanyuan300 <[email protected]>
Signed-off-by: xuanyuan300 <[email protected]>
---
cloudformation/multi-az/README.md | 25 +
cloudformation/multi-az/cf.json | 1018 ++++++++++++++++++++
cloudformation/multi-az/cf.rb | 298 ++++++
.../multi-az/shardingsphere-cloud-init.yml | 112 +++
cloudformation/multi-az/zookeeper-cloud-init.yml | 109 +++
.../apache-shardingsphere-5.2.0.json | 0
6 files changed, 1562 insertions(+)
diff --git a/cloudformation/multi-az/README.md
b/cloudformation/multi-az/README.md
new file mode 100644
index 0000000..f76fc85
--- /dev/null
+++ b/cloudformation/multi-az/README.md
@@ -0,0 +1,25 @@
+The `cf.json` is used to quickly deploy a Apache ShardSphere Proxy Cluster.
+
+
+## Develop
+
+We use the [cfndsl]('https://github.com/cfndsl/cfndsl') to generate
`CloudFormation` configuration.
+
+### Prerequisites
+* `cfndsl`
+
+***Please follow the steps provided by
[cfndsl]('https://github.com/cfndsl/cfndsl') to install.***
+
+### Step 1
+
+Use the following command to init `cfndsl`. (only run once):
+```shell
+cfndsl -u 94.0.0
+```
+
+### Step 2
+
+Use the following command to generate:
+```shell
+ cfndsl cf.rb -o cf.json --pretty
+```
\ No newline at end of file
diff --git a/cloudformation/multi-az/cf.json b/cloudformation/multi-az/cf.json
new file mode 100644
index 0000000..719feb6
--- /dev/null
+++ b/cloudformation/multi-az/cf.json
@@ -0,0 +1,1018 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+{
+ "AWSTemplateFormatVersion": "2010-09-09",
+ "Description": "Deploy a ShardingSphere Proxy Cluster in MultiAz mode",
+ "Parameters": {
+ "ZookeeperInstanceType": {
+ "Type": "String",
+ "Default": "t2.nano"
+ },
+ "ShardingSphereInstanceType": {
+ "Type": "String",
+ "Default": "t2.micro"
+ },
+ "KeyName": {
+ "Type": "String",
+ "Default": "test-tf",
+ "Description": "The ssh keypair for remote connetcion"
+ },
+ "ImageId": {
+ "Type": "AWS::EC2::Image::Id",
+ "Default": "ami-094bbd9e922dc515d"
+ },
+ "VpcId": {
+ "Type": "String",
+ "Default": "vpc-0ef2b7440d3ade8d5"
+ },
+ "Subnets": {
+ "Type": "CommaDelimitedList",
+ "Default":
"subnet-0f388a6f23063b8c9,subnet-0bc2cd85facb5ca06,subnet-009077567350ef1b7",
+ "Description": "List of subnets sorted by availability zone in your VPC"
+ },
+ "SecurityGroupIds": {
+ "Type": "CommaDelimitedList",
+ "Default": "sg-008e74936b3f9de19"
+ },
+ "HostedZoneName": {
+ "Type": "String",
+ "Default": "tsphere-ex.com"
+ },
+ "HostedZoneId": {
+ "Type": "String",
+ "Default": "Z07855663B17FC5XE8A3O"
+ },
+ "ShardingSpherePort": {
+ "Type": "String",
+ "Default": 3307
+ },
+ "ShardingSphereVersion": {
+ "Type": "String",
+ "Default": "5.2.1"
+ },
+ "ShardingSphereJavaMemOpts": {
+ "Type": "String",
+ "Default": "-Xmx512m -Xms512m -Xmn128m "
+ },
+ "ZookeeperVersion": {
+ "Type": "String",
+ "Default": "3.7.1"
+ },
+ "ZookeeperHeap": {
+ "Type": "String",
+ "Default": 1024,
+ "Description": "The maximum heap size given to ZooKeeper"
+ }
+ },
+ "Resources": {
+ "ZK1": {
+ "Type": "AWS::EC2::Instance",
+ "Properties": {
+ "AvailabilityZone": {
+ "Fn::Select": [
+ 0,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ },
+ "InstanceType": {
+ "Ref": "ZookeeperInstanceType"
+ },
+ "ImageId": {
+ "Ref": "ImageId"
+ },
+ "KeyName": {
+ "Ref": "KeyName"
+ },
+ "SubnetId": {
+ "Fn::Select": [
+ 0,
+ {
+ "Ref": "Subnets"
+ }
+ ]
+ },
+ "SecurityGroupIds": {
+ "Ref": "SecurityGroupIds"
+ },
+ "Tags": [
+ {
+ "Key": "Name",
+ "Value": "ZK-1"
+ }
+ ],
+ "UserData": {
+ "Fn::Base64": {
+ "Fn::Sub": [
+ "#cloud-config\n\npackages:\n- java\n- nc\n\nwrite_files:\n-
path: /run/zookeeper.service\n permissions: 0644\n content: |\n [Unit]\n
Description=ZooKeeper Service\n Documentation=http://zookeeper.apache.org\n
Requires=network.target\n After=network.target\n [Service]\n
Type=forking\n User=zookeeper\n Group=zookeeper\n
ExecStart=/usr/local/zookeeper/bin/zkServer.sh start
/usr/local/zookeeper/conf/zoo.cfg\n ExecStop=/usr/lib/zookeeper/bin/z [...]
+ {
+ "SERVERS": {
+ "Fn::Sub": "server.1=zk-1.${HostedZoneName}:2888:3888\n
server.2=zk-2.${HostedZoneName}:2888:3888\n
server.3=zk-3.${HostedZoneName}:2888:3888"
+ },
+ "VERSION": {
+ "Ref": "ZookeeperVersion"
+ },
+ "ZK_HEAP": {
+ "Ref": "ZookeeperHeap"
+ },
+ "INDEX": 1
+ }
+ ]
+ }
+ }
+ }
+ },
+ "zoneZK1": {
+ "Type": "AWS::Route53::RecordSet",
+ "Properties": {
+ "HostedZoneId": {
+ "Ref": "HostedZoneId"
+ },
+ "Name": {
+ "Fn::Sub": "zk-1.${HostedZoneName}"
+ },
+ "Type": "A",
+ "ResourceRecords": [
+ {
+ "Fn::GetAtt": [
+ "ZK1",
+ "PrivateIp"
+ ]
+ }
+ ],
+ "TTL": "60"
+ }
+ },
+ "ZK2": {
+ "Type": "AWS::EC2::Instance",
+ "Properties": {
+ "AvailabilityZone": {
+ "Fn::Select": [
+ 1,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ },
+ "InstanceType": {
+ "Ref": "ZookeeperInstanceType"
+ },
+ "ImageId": {
+ "Ref": "ImageId"
+ },
+ "KeyName": {
+ "Ref": "KeyName"
+ },
+ "SubnetId": {
+ "Fn::Select": [
+ 1,
+ {
+ "Ref": "Subnets"
+ }
+ ]
+ },
+ "SecurityGroupIds": {
+ "Ref": "SecurityGroupIds"
+ },
+ "Tags": [
+ {
+ "Key": "Name",
+ "Value": "ZK-2"
+ }
+ ],
+ "UserData": {
+ "Fn::Base64": {
+ "Fn::Sub": [
+ "#cloud-config\n\npackages:\n- java\n- nc\n\nwrite_files:\n-
path: /run/zookeeper.service\n permissions: 0644\n content: |\n [Unit]\n
Description=ZooKeeper Service\n Documentation=http://zookeeper.apache.org\n
Requires=network.target\n After=network.target\n [Service]\n
Type=forking\n User=zookeeper\n Group=zookeeper\n
ExecStart=/usr/local/zookeeper/bin/zkServer.sh start
/usr/local/zookeeper/conf/zoo.cfg\n ExecStop=/usr/lib/zookeeper/bin/z [...]
+ {
+ "SERVERS": {
+ "Fn::Sub": "server.1=zk-1.${HostedZoneName}:2888:3888\n
server.2=zk-2.${HostedZoneName}:2888:3888\n
server.3=zk-3.${HostedZoneName}:2888:3888"
+ },
+ "VERSION": {
+ "Ref": "ZookeeperVersion"
+ },
+ "ZK_HEAP": {
+ "Ref": "ZookeeperHeap"
+ },
+ "INDEX": 2
+ }
+ ]
+ }
+ }
+ }
+ },
+ "zoneZK2": {
+ "Type": "AWS::Route53::RecordSet",
+ "Properties": {
+ "HostedZoneId": {
+ "Ref": "HostedZoneId"
+ },
+ "Name": {
+ "Fn::Sub": "zk-2.${HostedZoneName}"
+ },
+ "Type": "A",
+ "ResourceRecords": [
+ {
+ "Fn::GetAtt": [
+ "ZK2",
+ "PrivateIp"
+ ]
+ }
+ ],
+ "TTL": "60"
+ }
+ },
+ "ZK3": {
+ "Type": "AWS::EC2::Instance",
+ "Properties": {
+ "AvailabilityZone": {
+ "Fn::Select": [
+ 2,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ },
+ "InstanceType": {
+ "Ref": "ZookeeperInstanceType"
+ },
+ "ImageId": {
+ "Ref": "ImageId"
+ },
+ "KeyName": {
+ "Ref": "KeyName"
+ },
+ "SubnetId": {
+ "Fn::Select": [
+ 2,
+ {
+ "Ref": "Subnets"
+ }
+ ]
+ },
+ "SecurityGroupIds": {
+ "Ref": "SecurityGroupIds"
+ },
+ "Tags": [
+ {
+ "Key": "Name",
+ "Value": "ZK-3"
+ }
+ ],
+ "UserData": {
+ "Fn::Base64": {
+ "Fn::Sub": [
+ "#cloud-config\n\npackages:\n- java\n- nc\n\nwrite_files:\n-
path: /run/zookeeper.service\n permissions: 0644\n content: |\n [Unit]\n
Description=ZooKeeper Service\n Documentation=http://zookeeper.apache.org\n
Requires=network.target\n After=network.target\n [Service]\n
Type=forking\n User=zookeeper\n Group=zookeeper\n
ExecStart=/usr/local/zookeeper/bin/zkServer.sh start
/usr/local/zookeeper/conf/zoo.cfg\n ExecStop=/usr/lib/zookeeper/bin/z [...]
+ {
+ "SERVERS": {
+ "Fn::Sub": "server.1=zk-1.${HostedZoneName}:2888:3888\n
server.2=zk-2.${HostedZoneName}:2888:3888\n
server.3=zk-3.${HostedZoneName}:2888:3888"
+ },
+ "VERSION": {
+ "Ref": "ZookeeperVersion"
+ },
+ "ZK_HEAP": {
+ "Ref": "ZookeeperHeap"
+ },
+ "INDEX": 3
+ }
+ ]
+ }
+ }
+ }
+ },
+ "zoneZK3": {
+ "Type": "AWS::Route53::RecordSet",
+ "Properties": {
+ "HostedZoneId": {
+ "Ref": "HostedZoneId"
+ },
+ "Name": {
+ "Fn::Sub": "zk-3.${HostedZoneName}"
+ },
+ "Type": "A",
+ "ResourceRecords": [
+ {
+ "Fn::GetAtt": [
+ "ZK3",
+ "PrivateIp"
+ ]
+ }
+ ],
+ "TTL": "60"
+ }
+ },
+ "networkiface0": {
+ "Type": "AWS::EC2::NetworkInterface",
+ "Properties": {
+ "SubnetId": {
+ "Fn::Select": [
+ 0,
+ {
+ "Ref": "Subnets"
+ }
+ ]
+ }
+ }
+ },
+ "networkiface1": {
+ "Type": "AWS::EC2::NetworkInterface",
+ "Properties": {
+ "SubnetId": {
+ "Fn::Select": [
+ 1,
+ {
+ "Ref": "Subnets"
+ }
+ ]
+ }
+ }
+ },
+ "networkiface2": {
+ "Type": "AWS::EC2::NetworkInterface",
+ "Properties": {
+ "SubnetId": {
+ "Fn::Select": [
+ 2,
+ {
+ "Ref": "Subnets"
+ }
+ ]
+ }
+ }
+ },
+ "launchtemplate0": {
+ "Type": "AWS::EC2::LaunchTemplate",
+ "Properties": {
+ "LaunchTemplateName": {
+ "Fn::Sub": [
+ "shardingsphere-${TMPL_NAME}",
+ {
+ "TMPL_NAME": {
+ "Fn::Select": [
+ 0,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "LaunchTemplateData": {
+ "ImageId": {
+ "Ref": "ImageId"
+ },
+ "InstanceType": {
+ "Ref": "ShardingSphereInstanceType"
+ },
+ "KeyName": {
+ "Ref": "KeyName"
+ },
+ "MetadataOptions": {
+ "HttpEndpoint": "enabled",
+ "HttpTokens": "required",
+ "InstanceMetadataTags": "enabled"
+ },
+ "Monitoring": {
+ "Enabled": true
+ },
+ "NetworkInterfaces": [
+ {
+ "DeleteOnTermination": false,
+ "DeviceIndex": 0,
+ "NetworkInterfaceId": {
+ "Fn::GetAtt": [
+ "networkiface0",
+ "Id"
+ ]
+ }
+ }
+ ],
+ "TagSpecifications": [
+ {
+ "ResourceType": "instance",
+ "Tags": [
+ {
+ "Key": "Name",
+ "Value": "shardingsphere-1"
+ }
+ ]
+ }
+ ],
+ "UserData": {
+ "Fn::Base64": {
+ "Fn::Sub": [
+ "#cloud-config\n\npackages:\n- java\n- nc\n\nwrite_files:\n-
path: /run/shardingsphere.service\n permissions: 0644\n content: |\n
[Unit]\n Description=ShardingSphere Service\n Requires=network.target\n
After=network.target\n [Service]\n Type=forking\n LimitNOFILE=65536\n
ExecStart=/usr/local/shardingsphere/bin/start.sh\n
ExecStop=/usr/local/shardingsphere/bin/stop.sh\n
Environment=\"JAVA_MEM_COMMON_OPTS=${JAVA_MEM_OPTS}\"\n Restart=on-ab [...]
+ {
+ "ZK_SERVERS": {
+ "Fn::Sub":
"zk-1.${HostedZoneName}:2181,zk-2.${HostedZoneName}:2181,zk-3.${HostedZoneName}:2181"
+ },
+ "VERSION": {
+ "Ref": "ShardingSphereVersion"
+ },
+ "JAVA_MEM_OPTS": {
+ "Ref": "ShardingSphereJavaMemOpts"
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "launchtemplate1": {
+ "Type": "AWS::EC2::LaunchTemplate",
+ "Properties": {
+ "LaunchTemplateName": {
+ "Fn::Sub": [
+ "shardingsphere-${TMPL_NAME}",
+ {
+ "TMPL_NAME": {
+ "Fn::Select": [
+ 1,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "LaunchTemplateData": {
+ "ImageId": {
+ "Ref": "ImageId"
+ },
+ "InstanceType": {
+ "Ref": "ShardingSphereInstanceType"
+ },
+ "KeyName": {
+ "Ref": "KeyName"
+ },
+ "MetadataOptions": {
+ "HttpEndpoint": "enabled",
+ "HttpTokens": "required",
+ "InstanceMetadataTags": "enabled"
+ },
+ "Monitoring": {
+ "Enabled": true
+ },
+ "NetworkInterfaces": [
+ {
+ "DeleteOnTermination": false,
+ "DeviceIndex": 0,
+ "NetworkInterfaceId": {
+ "Fn::GetAtt": [
+ "networkiface1",
+ "Id"
+ ]
+ }
+ }
+ ],
+ "TagSpecifications": [
+ {
+ "ResourceType": "instance",
+ "Tags": [
+ {
+ "Key": "Name",
+ "Value": "shardingsphere-2"
+ }
+ ]
+ }
+ ],
+ "UserData": {
+ "Fn::Base64": {
+ "Fn::Sub": [
+ "#cloud-config\n\npackages:\n- java\n- nc\n\nwrite_files:\n-
path: /run/shardingsphere.service\n permissions: 0644\n content: |\n
[Unit]\n Description=ShardingSphere Service\n Requires=network.target\n
After=network.target\n [Service]\n Type=forking\n LimitNOFILE=65536\n
ExecStart=/usr/local/shardingsphere/bin/start.sh\n
ExecStop=/usr/local/shardingsphere/bin/stop.sh\n
Environment=\"JAVA_MEM_COMMON_OPTS=${JAVA_MEM_OPTS}\"\n Restart=on-ab [...]
+ {
+ "ZK_SERVERS": {
+ "Fn::Sub":
"zk-1.${HostedZoneName}:2181,zk-2.${HostedZoneName}:2181,zk-3.${HostedZoneName}:2181"
+ },
+ "VERSION": {
+ "Ref": "ShardingSphereVersion"
+ },
+ "JAVA_MEM_OPTS": {
+ "Ref": "ShardingSphereJavaMemOpts"
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "launchtemplate2": {
+ "Type": "AWS::EC2::LaunchTemplate",
+ "Properties": {
+ "LaunchTemplateName": {
+ "Fn::Sub": [
+ "shardingsphere-${TMPL_NAME}",
+ {
+ "TMPL_NAME": {
+ "Fn::Select": [
+ 2,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "LaunchTemplateData": {
+ "ImageId": {
+ "Ref": "ImageId"
+ },
+ "InstanceType": {
+ "Ref": "ShardingSphereInstanceType"
+ },
+ "KeyName": {
+ "Ref": "KeyName"
+ },
+ "MetadataOptions": {
+ "HttpEndpoint": "enabled",
+ "HttpTokens": "required",
+ "InstanceMetadataTags": "enabled"
+ },
+ "Monitoring": {
+ "Enabled": true
+ },
+ "NetworkInterfaces": [
+ {
+ "DeleteOnTermination": false,
+ "DeviceIndex": 0,
+ "NetworkInterfaceId": {
+ "Fn::GetAtt": [
+ "networkiface2",
+ "Id"
+ ]
+ }
+ }
+ ],
+ "TagSpecifications": [
+ {
+ "ResourceType": "instance",
+ "Tags": [
+ {
+ "Key": "Name",
+ "Value": "shardingsphere-3"
+ }
+ ]
+ }
+ ],
+ "UserData": {
+ "Fn::Base64": {
+ "Fn::Sub": [
+ "#cloud-config\n\npackages:\n- java\n- nc\n\nwrite_files:\n-
path: /run/shardingsphere.service\n permissions: 0644\n content: |\n
[Unit]\n Description=ShardingSphere Service\n Requires=network.target\n
After=network.target\n [Service]\n Type=forking\n LimitNOFILE=65536\n
ExecStart=/usr/local/shardingsphere/bin/start.sh\n
ExecStop=/usr/local/shardingsphere/bin/stop.sh\n
Environment=\"JAVA_MEM_COMMON_OPTS=${JAVA_MEM_OPTS}\"\n Restart=on-ab [...]
+ {
+ "ZK_SERVERS": {
+ "Fn::Sub":
"zk-1.${HostedZoneName}:2181,zk-2.${HostedZoneName}:2181,zk-3.${HostedZoneName}:2181"
+ },
+ "VERSION": {
+ "Ref": "ShardingSphereVersion"
+ },
+ "JAVA_MEM_OPTS": {
+ "Ref": "ShardingSphereJavaMemOpts"
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "ssinternallb": {
+ "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
+ "Properties": {
+ "Name": "shardingsphere-internal-lb",
+ "Scheme": "internal",
+ "Type": "network",
+ "SubnetMappings": [
+ {
+ "SubnetId": {
+ "Fn::Select": [
+ 0,
+ {
+ "Ref": "Subnets"
+ }
+ ]
+ }
+ },
+ {
+ "SubnetId": {
+ "Fn::Select": [
+ 1,
+ {
+ "Ref": "Subnets"
+ }
+ ]
+ }
+ },
+ {
+ "SubnetId": {
+ "Fn::Select": [
+ 2,
+ {
+ "Ref": "Subnets"
+ }
+ ]
+ }
+ }
+ ],
+ "Tags": [
+ {
+ "Key": "Name",
+ "Value": "shardingsphere"
+ }
+ ]
+ }
+ },
+ "sslbtg": {
+ "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
+ "Properties": {
+ "Name": "shardingsphere-lb-tg",
+ "Port": {
+ "Ref": "ShardingSpherePort"
+ },
+ "Protocol": "TCP",
+ "VpcId": {
+ "Ref": "VpcId"
+ },
+ "TargetGroupAttributes": [
+ {
+ "Key": "preserve_client_ip.enabled",
+ "Value": "false"
+ }
+ ],
+ "Tags": [
+ {
+ "Key": "Name",
+ "Value": "shardingsphere"
+ }
+ ]
+ }
+ },
+ "autoscaling0": {
+ "Type": "AWS::AutoScaling::AutoScalingGroup",
+ "Properties": {
+ "AutoScalingGroupName": "shardingsphere-0",
+ "AvailabilityZones": [
+ {
+ "Fn::Select": [
+ 0,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ }
+ ],
+ "DesiredCapacity": "1",
+ "MaxSize": "1",
+ "MinSize": "1",
+ "HealthCheckGracePeriod": 60,
+ "HealthCheckType": "EC2",
+ "TargetGroupARNs": [
+ {
+ "Ref": "sslbtg"
+ }
+ ],
+ "LaunchTemplate": {
+ "LaunchTemplateName": {
+ "Fn::Sub": [
+ "shardingsphere-${TMPL_NAME}",
+ {
+ "TMPL_NAME": {
+ "Fn::Select": [
+ 0,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "Version": {
+ "Fn::GetAtt": [
+ "launchtemplate0",
+ "LatestVersionNumber"
+ ]
+ }
+ }
+ }
+ },
+ "autoscaling1": {
+ "Type": "AWS::AutoScaling::AutoScalingGroup",
+ "Properties": {
+ "AutoScalingGroupName": "shardingsphere-1",
+ "AvailabilityZones": [
+ {
+ "Fn::Select": [
+ 1,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ }
+ ],
+ "DesiredCapacity": "1",
+ "MaxSize": "1",
+ "MinSize": "1",
+ "HealthCheckGracePeriod": 60,
+ "HealthCheckType": "EC2",
+ "TargetGroupARNs": [
+ {
+ "Ref": "sslbtg"
+ }
+ ],
+ "LaunchTemplate": {
+ "LaunchTemplateName": {
+ "Fn::Sub": [
+ "shardingsphere-${TMPL_NAME}",
+ {
+ "TMPL_NAME": {
+ "Fn::Select": [
+ 1,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "Version": {
+ "Fn::GetAtt": [
+ "launchtemplate1",
+ "LatestVersionNumber"
+ ]
+ }
+ }
+ }
+ },
+ "autoscaling2": {
+ "Type": "AWS::AutoScaling::AutoScalingGroup",
+ "Properties": {
+ "AutoScalingGroupName": "shardingsphere-2",
+ "AvailabilityZones": [
+ {
+ "Fn::Select": [
+ 2,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ }
+ ],
+ "DesiredCapacity": "1",
+ "MaxSize": "1",
+ "MinSize": "1",
+ "HealthCheckGracePeriod": 60,
+ "HealthCheckType": "EC2",
+ "TargetGroupARNs": [
+ {
+ "Ref": "sslbtg"
+ }
+ ],
+ "LaunchTemplate": {
+ "LaunchTemplateName": {
+ "Fn::Sub": [
+ "shardingsphere-${TMPL_NAME}",
+ {
+ "TMPL_NAME": {
+ "Fn::Select": [
+ 2,
+ {
+ "Fn::GetAZs": {
+ "Ref": "AWS::Region"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "Version": {
+ "Fn::GetAtt": [
+ "launchtemplate2",
+ "LatestVersionNumber"
+ ]
+ }
+ }
+ }
+ },
+ "sslblistener": {
+ "Type": "AWS::ElasticLoadBalancingV2::Listener",
+ "Properties": {
+ "Port": {
+ "Ref": "ShardingSpherePort"
+ },
+ "LoadBalancerArn": {
+ "Ref": "ssinternallb"
+ },
+ "Protocol": "TCP",
+ "DefaultActions": [
+ {
+ "Type": "forward",
+ "TargetGroupArn": {
+ "Ref": "sslbtg"
+ }
+ }
+ ]
+ }
+ },
+ "ssinternaldomain": {
+ "Type": "AWS::Route53::RecordSet",
+ "Properties": {
+ "HostedZoneId": {
+ "Ref": "HostedZoneId"
+ },
+ "Name": {
+ "Fn::Sub": "shardingsphere.${HostedZoneName}"
+ },
+ "Type": "A",
+ "AliasTarget": {
+ "HostedZoneId": {
+ "Fn::GetAtt": [
+ "ssinternallb",
+ "CanonicalHostedZoneID"
+ ]
+ },
+ "DNSName": {
+ "Fn::GetAtt": [
+ "ssinternallb",
+ "DNSName"
+ ]
+ },
+ "EvaluateTargetHealth": true
+ }
+ }
+ }
+ },
+ "Outputs": {
+ "ssinternaldomain": {
+ "Value": {
+ "Ref": "ssinternaldomain"
+ },
+ "Export": {
+ "Name": {
+ "Fn::Sub": "${AWS::StackName}-ShardingSphere-Internal-Domain"
+ }
+ }
+ },
+ "ZK1": {
+ "Value": {
+ "Fn::Join": [
+ ":",
+ [
+ {
+ "Ref": "ZK1"
+ },
+ {
+ "Fn::GetAtt": [
+ "ZK1",
+ "PrivateIp"
+ ]
+ },
+ {
+ "Fn::GetAtt": [
+ "ZK1",
+ "AvailabilityZone"
+ ]
+ }
+ ]
+ ]
+ },
+ "Export": {
+ "Name": {
+ "Fn::Sub": "${AWS::StackName}-Zookeeper-Server-1"
+ }
+ }
+ },
+ "zoneZK1": {
+ "Value": {
+ "Ref": "zoneZK1"
+ },
+ "Export": {
+ "Name": {
+ "Fn::Sub": "${AWS::StackName}-Zookeeper-Domain-1"
+ }
+ }
+ },
+ "ZK2": {
+ "Value": {
+ "Fn::Join": [
+ ":",
+ [
+ {
+ "Ref": "ZK2"
+ },
+ {
+ "Fn::GetAtt": [
+ "ZK2",
+ "PrivateIp"
+ ]
+ },
+ {
+ "Fn::GetAtt": [
+ "ZK2",
+ "AvailabilityZone"
+ ]
+ }
+ ]
+ ]
+ },
+ "Export": {
+ "Name": {
+ "Fn::Sub": "${AWS::StackName}-Zookeeper-Server-2"
+ }
+ }
+ },
+ "zoneZK2": {
+ "Value": {
+ "Ref": "zoneZK2"
+ },
+ "Export": {
+ "Name": {
+ "Fn::Sub": "${AWS::StackName}-Zookeeper-Domain-2"
+ }
+ }
+ },
+ "ZK3": {
+ "Value": {
+ "Fn::Join": [
+ ":",
+ [
+ {
+ "Ref": "ZK3"
+ },
+ {
+ "Fn::GetAtt": [
+ "ZK3",
+ "PrivateIp"
+ ]
+ },
+ {
+ "Fn::GetAtt": [
+ "ZK3",
+ "AvailabilityZone"
+ ]
+ }
+ ]
+ ]
+ },
+ "Export": {
+ "Name": {
+ "Fn::Sub": "${AWS::StackName}-Zookeeper-Server-3"
+ }
+ }
+ },
+ "zoneZK3": {
+ "Value": {
+ "Ref": "zoneZK3"
+ },
+ "Export": {
+ "Name": {
+ "Fn::Sub": "${AWS::StackName}-Zookeeper-Domain-3"
+ }
+ }
+ }
+ }
+}
diff --git a/cloudformation/multi-az/cf.rb b/cloudformation/multi-az/cf.rb
new file mode 100644
index 0000000..c410e91
--- /dev/null
+++ b/cloudformation/multi-az/cf.rb
@@ -0,0 +1,298 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+CloudFormation {
+ Description "Deploy a ShardingSphere Proxy Cluster in MultiAz mode"
+
+ Parameter("ZookeeperInstanceType") {
+ String
+ Default "t2.nano"
+ }
+
+ Parameter("ShardingSphereInstanceType") {
+ String
+ Default "t2.micro"
+ }
+
+ Parameter("KeyName") {
+ String
+ Default "test-tf"
+ Description "The ssh keypair for remote connetcion"
+ }
+
+ Parameter("ImageId") {
+ Type "AWS::EC2::Image::Id"
+ Default "ami-094bbd9e922dc515d"
+ }
+
+ Parameter("VpcId") {
+ String
+ Default "vpc-0ef2b7440d3ade8d5"
+ Description "The id of your VPC"
+ }
+
+ Parameter("Subnets") {
+ Type 'CommaDelimitedList'
+ Default
"subnet-0f388a6f23063b8c9,subnet-0bc2cd85facb5ca06,subnet-009077567350ef1b7"
+ Description "List of subnets sorted by availability zone in your VPC"
+ }
+
+ Parameter("SecurityGroupIds") {
+ Type 'CommaDelimitedList'
+ Default "sg-008e74936b3f9de19"
+ Description "List of the id of the SecurityGroups, The security group
needs to allow ports 2888, 3888, and 2181 of the zk server to pass through."
+ }
+
+ Parameter("HostedZoneName") {
+ String
+ Default "shardingsphere.org"
+ Description "The name of the internal hosted zone, CloudFormation will
automatically create `proxy.[InternalHostedZoneName]` for other services to use"
+ }
+
+ Parameter("HostedZoneId") {
+ String
+ Default "Z07855663B17FC5XE8A3O"
+ Description "The zone id corresponding to HostedZoneName"
+ }
+
+ Parameter("ShardingSpherePort") {
+ Integer
+ Default 3307
+ }
+
+ Parameter("ShardingSphereVersion") {
+ String
+ Default "5.2.1"
+ }
+
+ Parameter("ShardingSphereJavaMemOpts") {
+ String
+ Default "-Xmx512m -Xms512m -Xmn128m "
+ }
+
+ Parameter("ZookeeperVersion") {
+ String
+ Default "3.7.1"
+ }
+
+ Parameter("ZookeeperHeap") {
+ Integer
+ Default 1024
+ Description "The maximum heap size given to ZooKeeper"
+ }
+
+
+ (0..2).each do |i|
+ name = "ZK#{i+1}"
+ EC2_Instance(name) {
+ AvailabilityZone FnSelect(i, FnGetAZs(Ref("AWS::Region")))
+ InstanceType Ref("ZookeeperInstanceType")
+ ImageId Ref("ImageId")
+ KeyName Ref("KeyName")
+ SubnetId FnSelect(i, Ref("Subnets"))
+ SecurityGroupIds Ref("SecurityGroupIds")
+ Tags [
+ Tag do
+ Key "Name"
+ Value "ZK-#{i+1}"
+ end
+ ]
+
+ (0)
+
+ server = "server.%{idx}=zk-%{idx}.${HostedZoneName}:2888:3888"
+ UserData FnBase64(
+ FnSub(
+ IO.read("./zookeeper-cloud-init.yml"),
+ :SERVERS => FnSub((0..2).map{|i| i == 0 ? server %{:idx => i+1} :
("#{server}" %{:idx => i+1}).insert(0, " " * 4)}.join("\n")),
+ :VERSION => Ref("ZookeeperVersion"),
+ :ZK_HEAP => Ref("ZookeeperHeap"),
+ :INDEX => i+1,
+ )
+ )
+ }
+
+ domain = "zone#{name}"
+ Route53_RecordSet(domain) {
+ HostedZoneId Ref("HostedZoneId")
+ Name FnSub("zk-#{i+1}.${HostedZoneName}")
+ Type "A"
+ ResourceRecords [FnGetAtt(name, "PrivateIp")]
+ TTL "60"
+ }
+ end
+
+ (0..2).each do |i|
+ name = "networkiface#{i}"
+ EC2_NetworkInterface(name) {
+ SubnetId FnSelect(i, Ref("Subnets"))
+ }
+ end
+
+ (0..2).each do |i|
+ name = "launchtemplate#{i}"
+ EC2_LaunchTemplate(name) {
+ LaunchTemplateName FnSub("shardingsphere-${TMPL_NAME}", :TMPL_NAME =>
FnSelect(i, FnGetAZs(Ref('AWS::Region'))))
+ LaunchTemplateData do
+ ImageId Ref("ImageId")
+ InstanceType Ref("ShardingSphereInstanceType")
+ KeyName Ref("KeyName")
+
+ MetadataOptions do
+ HttpEndpoint "enabled"
+ HttpTokens "required"
+ InstanceMetadataTags "enabled"
+ end
+
+ Monitoring do
+ Enabled true
+ end
+
+ NetworkInterfaces [
+ {
+ :DeleteOnTermination => false,
+ :DeviceIndex => 0,
+ :NetworkInterfaceId => FnGetAtt("networkiface#{i}", "Id")
+ }
+ ]
+
+ TagSpecifications [
+ {
+ :ResourceType => "instance",
+ :Tags => [
+ {
+ :Key => "Name",
+ :Value => "shardingsphere-#{i+1}"
+ }
+ ]
+ }
+ ]
+
+ UserData FnBase64(
+ FnSub(
+ IO.read("./shardingsphere-cloud-init.yml"),
+ :ZK_SERVERS => FnSub((0..2).map{|i|
"zk-#{i+1}.${HostedZoneName}:2181" }.join(",")),
+ :VERSION => Ref("ShardingSphereVersion"),
+ :JAVA_MEM_OPTS => Ref("ShardingSphereJavaMemOpts")
+ )
+ )
+ end
+ }
+ end
+
+ ElasticLoadBalancingV2_LoadBalancer("ssinternallb") {
+ Name "shardingsphere-internal-lb"
+ Scheme "internal"
+ Type "network"
+
+ mappings = (0..2).map { |x|
+ SubnetMapping do
+ SubnetId FnSelect(x, Ref("Subnets"))
+ end
+ }
+ SubnetMappings mappings
+ Tags [
+ Tag do
+ Key "Name"
+ Value "shardingsphere"
+ end
+ ]
+ }
+
+
+ ElasticLoadBalancingV2_TargetGroup("sslbtg") {
+ Name "shardingsphere-lb-tg"
+ Port Ref("ShardingSpherePort")
+ Protocol "TCP"
+ VpcId Ref("VpcId")
+ TargetGroupAttributes [
+ TargetGroupAttribute do
+ Key "preserve_client_ip.enabled"
+ Value "false"
+ end
+ ]
+ Tags [
+ Tag do
+ Key "Name"
+ Value "shardingsphere"
+ end
+ ]
+ }
+
+ (0..2).each do |i|
+ name = "autoscaling#{i}"
+ AutoScaling_AutoScalingGroup(name) {
+ AutoScalingGroupName "shardingsphere-#{i}"
+ AvailabilityZones [FnSelect(i, FnGetAZs(Ref("AWS::Region")))]
+ DesiredCapacity "1"
+ MaxSize "1"
+ MinSize "1"
+ HealthCheckGracePeriod 60
+ HealthCheckType "EC2"
+
+ TargetGroupARNs [ Ref("sslbtg")]
+
+ LaunchTemplate do
+ LaunchTemplateName FnSub("shardingsphere-${TMPL_NAME}", :TMPL_NAME =>
FnSelect(i, FnGetAZs(Ref('AWS::Region'))))
+ Version FnGetAtt("launchtemplate#{i}", "LatestVersionNumber")
+ end
+ }
+ end
+
+
+ ElasticLoadBalancingV2_Listener("sslblistener") {
+ Port Ref("ShardingSpherePort")
+ LoadBalancerArn Ref("ssinternallb")
+ Protocol "TCP"
+ DefaultActions [
+ {
+ :Type => "forward",
+ :TargetGroupArn => Ref("sslbtg")
+ }
+ ]
+ }
+
+ Route53_RecordSet("ssinternaldomain") {
+ HostedZoneId Ref("HostedZoneId")
+ Name FnSub("proxy.${HostedZoneName}")
+ Type "A"
+ AliasTarget do
+ HostedZoneId FnGetAtt("ssinternallb", "CanonicalHostedZoneID")
+ DNSName FnGetAtt("ssinternallb", "DNSName")
+ EvaluateTargetHealth true
+ end
+ }
+
+ Output("ssinternaldomain") do
+ Value Ref("ssinternaldomain")
+ Export FnSub("${AWS::StackName}-ShardingSphere-Internal-Domain")
+ end
+
+ (0..2).each do |i|
+ name = "ZK#{i+1}"
+ Output(name) do
+ Value FnJoin(":", [Ref(name), FnGetAtt(name, "PrivateIp"),
FnGetAtt(name, "AvailabilityZone")])
+ Export FnSub("${AWS::StackName}-Zookeeper-Server-#{i+1}")
+ end
+
+ zone_name = "zone#{name}"
+ Output(zone_name) do
+ Value Ref(zone_name)
+ Export FnSub("${AWS::StackName}-Zookeeper-Domain-#{i+1}")
+ end
+ end
+}
\ No newline at end of file
diff --git a/cloudformation/multi-az/shardingsphere-cloud-init.yml
b/cloudformation/multi-az/shardingsphere-cloud-init.yml
new file mode 100644
index 0000000..7f1969e
--- /dev/null
+++ b/cloudformation/multi-az/shardingsphere-cloud-init.yml
@@ -0,0 +1,112 @@
+#cloud-config
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+
+
+packages:
+- java
+- nc
+
+write_files:
+- path: /run/shardingsphere.service
+ permissions: 0644
+ content: |
+ [Unit]
+ Description=ShardingSphere Service
+ Requires=network.target
+ After=network.target
+ [Service]
+ Type=forking
+ LimitNOFILE=65536
+ ExecStart=/usr/local/shardingsphere/bin/start.sh
+ ExecStop=/usr/local/shardingsphere/bin/stop.sh
+ Environment="JAVA_MEM_COMMON_OPTS=${JAVA_MEM_OPTS}"
+ Restart=on-abort
+ [Install]
+ WantedBy=default.target
+
+- path: /run/server.yaml
+ permissions: 0644
+ content: |
+ mode:
+ type: Cluster
+ repository:
+ type: ZooKeeper
+ props:
+ namespace: governance_ds
+ server-lists: ${ZK_SERVERS}
+ retryIntervalMilliseconds: 500
+ timeToLiveSeconds: 60
+ maxRetries: 3
+ operationTimeoutMilliseconds: 500
+ rules:
+ - !AUTHORITY
+ users:
+ - root@%:root
+ - sharding@:sharding
+ provider:
+ type: ALL_PERMITTED
+ - !TRANSACTION
+ defaultType: XA
+ providerType: Atomikos
+ - !SQL_PARSER
+ sqlCommentParseEnabled: true
+ sqlStatementCache:
+ initialCapacity: 2000
+ maximumSize: 65535
+ parseTreeCache:
+ initialCapacity: 128
+ maximumSize: 1024
+ props:
+ max-connections-size-per-query: 1
+ kernel-executor-size: 16 # Infinite by default.
+ proxy-frontend-flush-threshold: 128 # The default value is 128.
+ proxy-hint-enabled: false
+ sql-show: false
+ check-table-metadata-enabled: false
+ # Proxy backend query fetch size. A larger value may increase the memory
usage of ShardingSphere Proxy.
+ # The default value is -1, which means set the minimum value for
different JDBC drivers.
+ proxy-backend-query-fetch-size: -1
+ proxy-frontend-executor-size: 0 # Proxy frontend executor size. The
default value is 0, which means let Netty decide.
+ # Available options of proxy backend executor suitable: OLAP(default),
OLTP. The OLTP option may reduce time cost of writing packets to client, but it
may increase the latency of SQL execution
+ # and block other clients if client connections are more than
`proxy-frontend-executor-size`, especially executing slow SQL.
+ proxy-backend-executor-suitable: OLAP
+ proxy-frontend-max-connections: 0 # Less than or equal to 0 means no
limitation.
+ # Available sql federation type: NONE (default), ORIGINAL, ADVANCED
+ sql-federation-type: NONE
+ # Available proxy backend driver type: JDBC (default), ExperimentalVertx
+ proxy-backend-driver-type: JDBC
+ proxy-mysql-default-version: 5.7.22 # In the absence of schema name, the
default version will be used.
+ proxy-default-port: 3307 # Proxy default port.
+ proxy-netty-backlog: 1024 # Proxy netty backlog.
+
+- path: /run/install_shardingsphere.sh
+ permissions: 0700
+ content: |
+ echo Installing ShardingSphere v${VERSION}
+ wget -O /run/ss.tar.gz
https://archive.apache.org/dist/shardingsphere/${VERSION}/apache-shardingsphere-${VERSION}-shardingsphere-proxy-bin.tar.gz
+ mkdir -p /usr/local/shardingsphere
+ tar xvf /run/ss.tar.gz --strip 1 -C /usr/local/shardingsphere
+ /bin/cp -avf /run/server.yaml /usr/local/shardingsphere/conf/server.yaml
+ /bin/cp -avf /run/shardingsphere.service
/usr/lib/systemd/system/shardingsphere.service
+ systemctl daemon-reload
+ systemctl enable shardingsphere
+ systemctl start shardingsphere
+
+runcmd:
+- /run/install_shardingsphere.sh
diff --git a/cloudformation/multi-az/zookeeper-cloud-init.yml
b/cloudformation/multi-az/zookeeper-cloud-init.yml
new file mode 100644
index 0000000..0427faf
--- /dev/null
+++ b/cloudformation/multi-az/zookeeper-cloud-init.yml
@@ -0,0 +1,109 @@
+#cloud-config
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+
+packages:
+- java
+- nc
+
+write_files:
+- path: /run/zookeeper.service
+ permissions: 0644
+ content: |
+ [Unit]
+ Description=ZooKeeper Service
+ Documentation=http://zookeeper.apache.org
+ Requires=network.target
+ After=network.target
+ [Service]
+ Type=forking
+ User=zookeeper
+ Group=zookeeper
+ ExecStart=/usr/local/zookeeper/bin/zkServer.sh start
/usr/local/zookeeper/conf/zoo.cfg
+ ExecStop=/usr/lib/zookeeper/bin/zkServer.sh stop
/usr/local/zookeeper/conf/zoo.cfg
+ ExecReload=/usr/lib/zookeeper/bin/zkServer.sh restart
/usr/local/zookeeper/conf/zoo.cfg
+ WorkingDirectory=/usr/local/zookeeper
+ PIDFile=/usr/local/zookeeper/data/zookeeper_server.pid
+ Environment=ZK_SERVER_HEAP=${ZK_HEAP}
+ [Install]
+ WantedBy=default.target
+
+- path: /run/zoo.cfg
+ permissions: 0644
+ content: |
+ # The number of milliseconds of each tick
+ tickTime=2000
+ # The number of ticks that the initial
+ # synchronization phase can take
+ initLimit=10
+ # The number of ticks that can pass between
+ # sending a request and getting an acknowledgement
+ syncLimit=5
+ # the directory where the snapshot is stored.
+ # do not use /tmp for storage, /tmp here is just
+ # example sakes.
+ dataDir=/usr/local/zookeeper/data
+ # the port at which the clients will connect
+ clientPort=2181
+ # the maximum number of client connections.
+ # increase this if you need to handle more clients
+ #maxClientCnxns=60
+ #
+ # Be sure to read the maintenance section of the
+ # administrator guide before turning on autopurge.
+ #
+ #
http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
+ #
+ # The number of snapshots to retain in dataDir
+ #autopurge.snapRetainCount=3
+ # Purge task interval in hours
+ # Set to "0" to disable auto purge feature
+ #autopurge.purgeInterval=1
+
+ ## Metrics Providers
+ #
+ # https://prometheus.io Metrics Exporter
+
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
+ #metricsProvider.httpPort=7000
+ #metricsProvider.exportJvmInfo=true
+ 4lw.commands.whitelist=stat, ruok, conf, isro
+ ${SERVERS}
+
+- path: /run/install_zk.sh
+ permissions: 0700
+ content: |
+ #!/bin/bash
+ echo create zk user
+ useradd zookeeper -s /sbin/nologin || :
+
+ echo Installing Zookeeper v${VERSION}
+ wget -O /run/zk.tgz
https://archive.apache.org/dist/zookeeper/zookeeper-${VERSION}/apache-zookeeper-${VERSION}-bin.tar.gz
+ mkdir -p /usr/local/zookeeper
+ tar zxvf /run/zk.tgz --strip 1 -C /usr/local/zookeeper
+ mkdir -p /usr/local/zookeeper/data
+ echo ${INDEX} > /usr/local/zookeeper/data/myid
+ /bin/cp -avf /run/zoo.cfg /usr/local/zookeeper/conf/zoo.cfg
+ /bin/cp -avf /run/zookeeper.service
/usr/lib/systemd/system/zookeeper.service
+ chown -R zookeeper:zookeeper /usr/local/zookeeper
+ systemctl daemon-reload
+ systemctl enable zookeeper
+ systemctl start zookeeper
+
+runcmd:
+- /run/install_zk.sh
+
\ No newline at end of file
diff --git a/cloudformation/apache-shardingsphere-5.2.0.json
b/cloudformation/single-az/apache-shardingsphere-5.2.0.json
similarity index 100%
rename from cloudformation/apache-shardingsphere-5.2.0.json
rename to cloudformation/single-az/apache-shardingsphere-5.2.0.json