forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
existing-vpc-cluster-zookeeper.yml
827 lines (786 loc) · 27.2 KB
/
existing-vpc-cluster-zookeeper.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 在已有VPC基础上,部署Zookeeper 3.6.2集群,通过ESS自动伸缩管理节点,集成OOS任务实现弹性扩容/缩容时动态配置,保障高可用性与数据一致性。
en: Deploy a Zookeeper 3.6.2 cluster atop an existing Virtual Private Cloud (VPC),
with Elastic Scaling Service (ESS) automating node management for scaling, and
integrating Operations Orchestration Service (OOS) tasks to dynamically configure
during elastic expansion or contraction, ensuring high availability and data consistency.
Parameters:
VSwitchZoneId:
Type: String
Label:
en: VSwitch Availability Zone
zh-cn: 交换机可用区
Description:
en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please
confirm that the Availability Zone supports the specification of creating
ECS resources,which is recommended to be different from other VSwitch Availability
Zone</font></b>
zh-cn: 可用区ID。<br><b>注: <font color='blue'>选择前请确认该可用区是否支持创建ECS资源的规格,建议与其他交换机可用区不同</font></b>
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
VPC:
Type: String
Label:
en: Existing VPC Instance ID
zh-cn: 现有VPC的实例ID
Description:
en: Please search the ID starts with (vpc-xxx)from console-Virtual Private Cloud
zh-cn: 现有虚拟专有网络的实例ID,控制台-VPC-专有网络下查询
AssociationProperty: ALIYUN::ECS::VPC::VPCId
VSwitch:
Type: String
Label:
en: Existing VSwitch ID
zh-cn: 网络交换机ID
Description:
en: Please search the business VSwitch ID starts with(vsw-xxx)from console-Virtual
Private Cloud-VSwitches
zh-cn: 现有业务网络交换机的实例ID,控制台-VPC-专有网络-交换机下查询
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: VPC
ZoneId: VSwitchZoneId
SecurityGroup:
Type: String
Label:
en: Business Security Group ID
zh-cn: 业务安全组ID
Description:
en: Please search the business security group ID starting with(sg-xxx)from console-ECS-Network
& Security
zh-cn: 现有业务安全组的实例ID,控制台-ECS-网络与安全-安全组下查询
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
AssociationPropertyMetadata:
VpcId: VPC
InstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例规格
Description:
en: <font color='blue'><b>1.Before selecting the model please confirm that the
current available zone under the model is in stock, some models need to be
reported in advance</b></font><br><font color='blue'><b>2.List of optional
models</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB Intranet
bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge
<font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and
receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU
16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]
zh-cn: <font color='blue'><b>1.选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备</b></font><br><font
color='blue'><b>2.可选机型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU
4GiB 内网带宽1Gbps 内网收发包30万PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU
8GiB 内网带宽1.5Gbps 内网收发包50万PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU
16GiB 内网带宽2.5Gbps 内网收发包80万PPS</font>]
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: VSwitchZoneId
ImageId:
Type: String
Label:
en: Image
zh-cn: 镜像
Description:
en: Image ID,Please use Centos7, see detail:<b><a href='https://www.alibabacloud.com/help/en/doc-detail/112977.html'
target='_blank'><font color='blue'>Find the mirror</font></a></b>
zh-cn: 镜像ID, 请使用Centos7, 详见:<b><a href='https://help.aliyun.com/document_detail/112977.html'
target='_blank'><font color='blue'>查找镜像</font></a></b>
Default: centos_7_04_64_20G_alibase_201701015.vhd
ClusterAmount:
Type: Number
Label:
en: Number of cluster hosts
zh-cn: 集群主机数
Description:
en: 'Number of cluster hosts, value range: [3~10], In order to ensure the availability
and fault tolerance of zookeeper clusters, it is recommended to set the number
of clusters to be odd.'
zh-cn: 集群主机数量,取值范围:[3~10],为了保证zookeeper集群的可用性与容错性,建议设置集群数为奇数。
Default: 3
MinValue: 3
MaxValue: 10
SystemDiskCategory:
Type: String
Label:
en: System Disk Type
zh-cn: 系统盘类型
Description:
en: '<font color=''blue''><b>Optional values:</b></font><br>[cloud_efficiency:
<font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD
Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud:
<font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local
SSD Cloud Disk</font>]'
zh-cn: '<font color=''blue''><b>可选值:</b></font><br>[cloud_efficiency: <font
color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd:
<font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]<br>[ephemeral_ssd:
<font color=''green''>本地SSD盘</font>]'
Default: cloud_efficiency
AllowedValues:
- cloud_auto
- cloud_efficiency
- cloud_ssd
- cloud
- cloud_essd
- ephemeral_ssd
SystemDiskSize:
Type: Number
Label:
en: System Disk Space
zh-cn: 系统盘空间
Description:
en: 'System disk size, range of values: 40-500, units: GB.'
zh-cn: 系统盘大小, 取值范围:[40, 500], 单位:GB。
Default: 40
ZkuiAdminPassword:
Type: String
Label:
en: Zookeeper Web Admin Password
zh-cn: Zookeeper Web Admin用户登录密码
Description:
en: Zookeeper Web Admin Password, Length 8-30。
zh-cn: Zookeeper Web Admin用户登录密码,长度8-30。
MinLength: 8
MaxLength: 30
NoEcho: true
Password:
Type: String
Label:
en: Instance Password
zh-cn: 实例密码
Description:
en: Server login password, Length 8-30, must contain three(Capital letters,
lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol
in).
zh-cn: 服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
ConstraintDescription:
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers,
()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
AllowedPattern: '[0-9A-Za-z\_\-\&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$'
MinLength: 8
MaxLength: 30
NoEcho: true
Resources:
EssScalingGroup:
Type: ALIYUN::ESS::ScalingGroup
Properties:
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch
MaxSize:
Fn::Calculate:
- '{0}-1'
- 1
- - Ref: ClusterAmount
MinSize:
Fn::Calculate:
- '{0}-1'
- 1
- - Ref: ClusterAmount
Metadata:
ALIYUN::ROS::Designer:
id: 9b443edc-a003-4fcc-bd1a-27fb6597c7d6
EssLifecycleHook:
Type: ALIYUN::ESS::LifecycleHook
Properties:
LifecycleHookName: zookeeper_scale_in_rule
LifecycleTransition: SCALE_IN
NotificationArn:
Fn::Join:
- ''
- - 'acs:ess:'
- Ref: ALIYUN::Region
- ':'
- Ref: ALIYUN::TenantId
- ':'
- oos/ACS-ESS-LifeCycleRunCommand
NotificationMetadata:
Fn::Join:
- ''
- - |-
{
"commandContent": "/home/zookeeper/apache-zookeeper-3.6.2-bin/bin/zkServer.sh stop; python /home/zookeeper/remove_node_with_slave.py",
"commandType": "RunShellScript",
"OOSAssumeRole": "
- Fn::GetAtt:
- EssRole
- RoleName
- |-
",
"regionId": "${regionId}",
"instanceIds": "${instanceIds}",
"lifecycleHookId": "${lifecycleHookId}",
"rateControl": "{\"Mode\":\"Concurrency\",\"MaxErrors\":0,\"Concurrency\":10}",
"lifecycleActionToken": "${lifecycleActionToken}"
}
ScalingGroupId:
Ref: EssScalingGroup
DependsOn:
- EssScalingGroup
Metadata:
ALIYUN::ROS::Designer:
id: 71dbd54a-a1a5-44cf-8ac2-0804b0fca3db
EssRole:
Type: ALIYUN::RAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service:
- oos.aliyuncs.com
Version: '1'
Policies:
- PolicyDocument:
Statement:
- Action:
- ecs:*
Effect: Allow
Resource:
- '*'
- Action:
- ess:*
Effect: Allow
Resource:
- '*'
Version: '1'
PolicyName:
Fn::Sub: EssRamRolePolicy-${ALIYUN::StackId}
RoleName:
Fn::Sub: EssRamRoleRam-${ALIYUN::StackId}
Metadata:
ALIYUN::ROS::Designer:
id: c6dabc70-0f99-43c4-a316-e082e11900d0
EssScalingConfiguration:
Type: ALIYUN::ESS::ScalingConfiguration
Properties:
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
InstanceType:
Ref: InstanceType
InternetChargeType: PayByTraffic
InternetMaxBandwidthIn: 100
InternetMaxBandwidthOut: 100
ScalingGroupId:
Ref: EssScalingGroup
SystemDiskCategory:
Ref: SystemDiskCategory
SystemDiskSize:
Ref: SystemDiskSize
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- EssWaitConditionHandle
- CurlCli
- Fn::Join:
- ''
- - '#!/bin/sh'
- " \n"
- ssh_pub_key_json='
- Fn::GetAtt:
- MasterWaitCondition
- Data
- '''
'
- master_ipaddr=
- Fn::Select:
- '0'
- Fn::GetAtt:
- ZookeeperMasterServer
- PrivateIps
- '
'
- master_password=
- Ref: Password
- '
'
- "ConfigSSH() { \n"
- ' echo $ssh_pub_key_json > /tmp/pubkey
'
- ' new_hostname=''follower''`tr -dc "0-9" < /dev/urandom | head -c
9`
'
- ' hostnamectl set-hostname ${new_hostname}
'
- ' su -
'
- " HOSTNAME=`hostname` \n"
- " HOST_IP=`ifconfig eth0 | awk '/inet /{print $2}'` \n"
- ' yum install -y jq
'
- ' yum install -y expect
'
- ' pub_key=`echo "$ssh_pub_key_json" | jq ''.ssh_pub_key'' | xargs
echo `
'
- ' echo "$pub_key" > /root/.ssh/authorized_keys
'
- ' chmod 600 /root/.ssh/authorized_keys
'
- " sed -i 's/# StrictHostKeyChecking ask/StrictHostKeyChecking no/'\
\ /etc/ssh/ssh_config \n"
- " sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/ssh_config\
\ \n"
- ' service sshd restart
'
- ' echo $pub_key > /tmp/real_pub_key
'
- "} \n"
- " \n"
- "DownloadPackage() { \n"
- " yum update -y \n"
- " yum -y install glibc.i686 \n"
- " mkdir /home/zookeeper \n"
- " cd /home/zookeeper \n"
- " wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.6.2/apache-zookeeper-3.6.2-bin.tar.gz\
\ \n"
- " wget https://ros-template-resources.oss-cn-beijing.aliyuncs.com/Kafka/jdk-8u251-linux-i586.rpm\
\ \n"
- "} \n"
- " \n"
- "SetConfig() { \n"
- " cd /home/zookeeper \n"
- " rpm -Uvh jdk-8u251-linux-i586.rpm \n"
- " JAVA_HOME=`find / -name jdk1.8.0_*` \n"
- " echo export JAVA_HOME=${JAVA_HOME} >> /etc/profile \n"
- " echo export JRE_HOME=${JAVA_HOME}/jre >> /etc/profile \n"
- " echo export CLASSPATH=${JAVA_HOME}/lib >> /etc/profile \n"
- " echo export PATH=${JAVA_HOME}/bin:$PATH >> /etc/profile \n"
- " tar -zxvf apache-zookeeper-3.6.2-bin.tar.gz \n"
- " mkdir /home/zookeeper/apache-zookeeper-3.6.2-bin/data \n"
- " cp /home/zookeeper/apache-zookeeper-3.6.2-bin/conf/zoo_sample.cfg\
\ /home/zookeeper/apache-zookeeper-3.6.2-bin/conf/zoo.cfg \n"
- " sed -i \"s%dataDir=.*%dataDir=/home/zookeeper/apache-zookeeper-3.6.2-bin/data%g\"\
\ /home/zookeeper/apache-zookeeper-3.6.2-bin/conf/zoo.cfg \n"
- " echo \"4lw.commands.whitelist=*\" >> /home/zookeeper/apache-zookeeper-3.6.2-bin/conf/zoo.cfg\
\ \n"
- "} \n"
- " \n"
- JoinSlaveInMaster() {
- ' echo "/home/zookeeper/apache-zookeeper-3.6.2-bin/bin/zkServer.sh
start" >> /etc/rc.d/rc.local
'
- ' chmod +x /etc/rc.d/rc.local
'
- " wget -P /home/zookeeper https://ros-template-resources.oss-cn-beijing.aliyuncs.com/Zookeeper/slave_add_node_into_master.py\
\ \n"
- " wget -P /home/zookeeper https://ros-template-resources.oss-cn-beijing.aliyuncs.com/Zookeeper/remove_node_with_slave.py\
\ \n"
- " pip install bcrypt==3.1.3 \n"
- " pip install paramiko \n"
- " python /home/zookeeper/slave_add_node_into_master.py --master_host_ip=${master_ipaddr}\
\ --master_host_password=${master_password} >> /tmp/log.txt 2>&1 & \n"
- "} \n"
- " \n"
- "main() { \n"
- " ConfigSSH \n"
- " DownloadPackage \n"
- " SetConfig \n"
- " JoinSlaveInMaster \n"
- "} \n"
- "main \n"
- "ros-notify -d \"{\\\"Data\\\" : \\\"Final Success\\\", \\\"Status\\\
\" : \\\"Success\\\"}\" \n"
Metadata:
ALIYUN::ROS::Designer:
id: dd2a84eb-b2ba-423e-840b-9b47ad2fef65
MasterWaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: 7b968f53-120e-4103-a331-7c7aceee8d78
MasterWaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: MasterWaitConditionHandle
Timeout: 1800
Metadata:
ALIYUN::ROS::Designer:
id: 8d205df5-4e4b-47e0-a0a4-159aae8de6dd
EssScalingGroupEnable:
Type: ALIYUN::ESS::ScalingGroupEnable
Properties:
ScalingConfigurationId:
Fn::GetAtt:
- EssScalingConfiguration
- ScalingConfigurationId
ScalingGroupId:
Fn::GetAtt:
- EssScalingGroup
- ScalingGroupId
DependsOn: MasterWaitCondition
Metadata:
ALIYUN::ROS::Designer:
id: 483b3434-e2f5-47b3-9a9f-22d8d03e0d3c
EssWaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: 818734d2-aa98-4659-99ce-1e5eec6d4e0d
EssWaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count:
Fn::Calculate:
- '{0}-1'
- 1
- - Ref: ClusterAmount
Handle:
Ref: EssWaitConditionHandle
Timeout: 1800
DependsOn:
- EssScalingConfiguration
Metadata:
ALIYUN::ROS::Designer:
id: 63e1e426-37bd-4504-aa5b-eb7362c3269d
ZookeeperMasterServer:
Type: ALIYUN::ECS::InstanceGroup
Properties:
ZoneId:
Ref: VSwitchZoneId
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
AllocatePublicIP: true
InstanceName: ZookeeperMasterServer
InstanceType:
Ref: InstanceType
MaxAmount: 1
Password:
Ref: Password
SystemDiskCategory:
Ref: SystemDiskCategory
SystemDiskSize:
Ref: SystemDiskSize
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- MasterWaitConditionHandle
- CurlCli
- Fn::Join:
- ''
- - '#!/bin/sh'
- " \n"
- ZkuiAdminPassword=
- Ref: ZkuiAdminPassword
- '
'
- "ConfigSSH() { \n"
- " yum update -y \n"
- " yum install -y expect \n"
- " yum install -y jq \n"
- ' echo ''#!/usr/bin/expect'' > /tmp/ssh_gen_key
'
- ' echo spawn ssh-keygen -t rsa >> /tmp/ssh_gen_key
'
- ' echo ''expect {'' >> /tmp/ssh_gen_key
'
- ' echo '' "*(/root/.ssh/id_rsa)" {send "\n\r";exp_continue}''
>> /tmp/ssh_gen_key
'
- ' echo '' "*(empty for no passphrase)" {send "\n\r";exp_continue}''
>> /tmp/ssh_gen_key
'
- ' echo '' "*again" {send "\n\r"}'' >> /tmp/ssh_gen_key
'
- ' echo ''}'' >> /tmp/ssh_gen_key
'
- ' echo ''expect eof'' >> /tmp/ssh_gen_key
'
- " \n"
- ' /usr/bin/expect /tmp/ssh_gen_key
'
- ' pub_key=`cat /root/.ssh/id_rsa.pub`
'
- " sed -i 's/# StrictHostKeyChecking ask/StrictHostKeyChecking no/'\
\ /etc/ssh/ssh_config \n"
- " sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/ssh_config\
\ \n"
- ' service sshd restart
'
- "} \n"
- '
'
- "DownloadPackages() { \n"
- " yum -y install glibc.i686 \n"
- " mkdir /home/zookeeper \n"
- " cd /home/zookeeper \n"
- " wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.6.2/apache-zookeeper-3.6.2-bin.tar.gz\
\ \n"
- " wget https://ros-template-resources.oss-cn-beijing.aliyuncs.com/Kafka/jdk-8u251-linux-i586.rpm\
\ \n"
- "} \n"
- '
'
- "SetConfig() { \n"
- " rpm -Uvh jdk-8u251-linux-i586.rpm \n"
- " JAVA_HOME=`find / -name jdk1.8.0_*` \n"
- " echo export JAVA_HOME=${JAVA_HOME} >> /etc/profile \n"
- " echo export JRE_HOME=${JAVA_HOME}/jre >> /etc/profile \n"
- " echo export CLASSPATH=${JAVA_HOME}/lib >> /etc/profile \n"
- " echo export PATH=${JAVA_HOME}/bin:$PATH >> /etc/profile \n"
- " tar -zxvf apache-zookeeper-3.6.2-bin.tar.gz \n"
- " mkdir /home/zookeeper/apache-zookeeper-3.6.2-bin/data \n"
- " touch /home/zookeeper/collection \n"
- " echo 0 >> /home/zookeeper/finish_sign \n"
- " cp /home/zookeeper/apache-zookeeper-3.6.2-bin/conf/zoo_sample.cfg\
\ /home/zookeeper/apache-zookeeper-3.6.2-bin/conf/zoo.cfg \n"
- " sed -i \"s%dataDir=.*%dataDir=/home/zookeeper/apache-zookeeper-3.6.2-bin/data%g\"\
\ /home/zookeeper/apache-zookeeper-3.6.2-bin/conf/zoo.cfg \n"
- " echo \"4lw.commands.whitelist=*\" >> /home/zookeeper/apache-zookeeper-3.6.2-bin/conf/zoo.cfg\
\ \n"
- "} \n"
- '
'
- "StartCheckJoinService() { \n"
- ' echo "/home/zookeeper/apache-zookeeper-3.6.2-bin/bin/zkServer.sh
start" >> /etc/rc.d/rc.local
'
- ' chmod +x /etc/rc.d/rc.local
'
- " wget -P /home/zookeeper https://ros-template-resources.oss-cn-beijing.aliyuncs.com/Zookeeper/check_join_node_in_master.py\
\ \n"
- " wget -P /home/zookeeper https://ros-template-resources.oss-cn-beijing.aliyuncs.com/Zookeeper/remove_node_with_master.py\
\ \n"
- " nohup python /home/zookeeper/check_join_node_in_master.py >> /tmp/log.txt\
\ 2>&1 & \n"
- ' echo "nohup python /home/zookeeper/check_join_node_in_master.py >>
/tmp/log.txt 2>&1 &" >> /etc/rc.d/rc.local
'
- "} \n"
- '
'
- 'InstallZkui() {
'
- ' HostIP=`ifconfig eth0 | awk ''/inet /{print $2}''`
'
- " cd /home/zookeeper \n"
- " wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz\
\ \n"
- " tar zxvf apache-maven-3.5.4-bin.tar.gz \n"
- " MAVEN_HOME=`find / -name apache-maven-3.5.4` \n"
- " echo export MAVEN_HOME=${MAVEN_HOME} >> /etc/profile \n"
- " echo export MAVEN_HOME >> /etc/profile \n"
- " echo export PATH=${PATH}:${MAVEN_HOME}/bin >> /etc/profile \n"
- " source /etc/profile \n"
- " yum install git -y \n"
- " git clone https://github.com/DeemOpen/zkui.git \n"
- " cd zkui/ \n"
- " mvn clean install \n"
- " mv target /usr/local/zkui \n"
- " sed -i \"s%zkServer=.*%zkServer=${HostIP}:2181%g\" config.cfg \
\ \n"
- " sed -i 's%userSet =.*%userSet ={\"users\": [{ \"username\":\"admin\"\
\ , \"password\":\"'${ZkuiAdminPassword}'\",\"role\": \"ADMIN\" },{\
\ \"username\":\"appconfig\" , \"password\":\"appconfig\",\"role\":\
\ \"USER\" }]}%g' config.cfg \n"
- " cp config.cfg /usr/local/zkui/ \n"
- "} \n"
- '
'
- "main() { \n"
- " ConfigSSH \n"
- " DownloadPackages \n"
- " SetConfig \n"
- " InstallZkui \n"
- " StartCheckJoinService \n"
- "} \n"
- '
'
- "main \n"
- 'cmd="ros-notify -d ''{\"id\" : \"ssh_pub_key\", \"data\" : \"$pub_key\"}''"
'
- 'eval $cmd
'
Metadata:
ALIYUN::ROS::Designer:
id: d5a86671-e95a-4f66-ab03-6a73f2f66316
Outputs:
EcsInstanceIds:
Value:
Fn::Select:
- '0'
- Fn::GetAtt:
- ZookeeperMasterServer
- InstanceIds
ZookeeperConnectionAddress:
Value:
Fn::Join:
- ''
- - Fn::Select:
- '0'
- Fn::GetAtt:
- ZookeeperMasterServer
- PrivateIps
- :2181
ZookeeperHomePath:
Value: /home/zookeeper/apache-zookeeper-3.6.2-bin
ZookeeperWebUrl:
Value:
Fn::Join:
- ''
- - Fn::Select:
- '0'
- Fn::GetAtt:
- ZookeeperMasterServer
- PublicIps
- :9090
ZookeeperWebUser:
Value: admin
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VSwitchZoneId
- VPC
- VSwitch
- SecurityGroup
Label:
default:
en: Infrastructure Configuration
zh-cn: 基础资源配置(必填)
- Parameters:
- InstanceType
- ImageId
- ClusterAmount
- SystemDiskCategory
- SystemDiskSize
- ZkuiAdminPassword
- Password
Label:
default:
en: Zookeeper Configuration
zh-cn: Zookeeper 配置(必填)
TemplateTags:
- acs:solution:中间件:Zookeeper集群版(已有VPC)
ALIYUN::ROS::Designer:
0e4b396e-fec8-42c2-b0f9-4f9ba4c6af10:
source:
id: 8d205df5-4e4b-47e0-a0a4-159aae8de6dd
target:
id: 7b968f53-120e-4103-a331-7c7aceee8d78
z: 1
25ab188e-9dd9-4425-b7fc-79c20075a6a9:
source:
id: 483b3434-e2f5-47b3-9a9f-22d8d03e0d3c
target:
id: dd2a84eb-b2ba-423e-840b-9b47ad2fef65
z: 1
483b3434-e2f5-47b3-9a9f-22d8d03e0d3c:
position:
x: 208
y: 427
size:
height: 60
width: 60
z: 0
4c00f68d-e936-4b19-9e10-f41796cfebb2:
source:
id: 71dbd54a-a1a5-44cf-8ac2-0804b0fca3db
target:
id: dd2a84eb-b2ba-423e-840b-9b47ad2fef65
z: 1
63e1e426-37bd-4504-aa5b-eb7362c3269d:
position:
x: 399
y: 135
size:
height: 60
width: 60
z: 0
71dbd54a-a1a5-44cf-8ac2-0804b0fca3db:
position:
x: 402
y: 428
size:
height: 60
width: 60
z: 0
7b968f53-120e-4103-a331-7c7aceee8d78:
position:
x: -115
y: 177
size:
height: 60
width: 60
z: 0
818734d2-aa98-4659-99ce-1e5eec6d4e0d:
position:
x: 231
y: 135
size:
height: 60
width: 60
z: 0
8d205df5-4e4b-47e0-a0a4-159aae8de6dd:
position:
x: -115
y: 384
size:
height: 60
width: 60
z: 0
9b443edc-a003-4fcc-bd1a-27fb6597c7d6:
position:
x: 137
y: 254
size:
height: 60
width: 60
z: 0
c6dabc70-0f99-43c4-a316-e082e11900d0:
position:
x: 453
y: 254
size:
height: 60
width: 60
z: 0
ca1a9776-4da7-4ae8-922f-2571c8d840cc:
source:
id: dd2a84eb-b2ba-423e-840b-9b47ad2fef65
target:
id: c6dabc70-0f99-43c4-a316-e082e11900d0
z: 1
d5a86671-e95a-4f66-ab03-6a73f2f66316:
position:
x: -3
y: 257
size:
height: 60
width: 60
z: 0
dc60afa7-7f42-41b5-92ad-fc35dc18888f:
source:
id: 483b3434-e2f5-47b3-9a9f-22d8d03e0d3c
target:
id: 9b443edc-a003-4fcc-bd1a-27fb6597c7d6
z: 1
dd2a84eb-b2ba-423e-840b-9b47ad2fef65:
position:
x: 291
y: 254
size:
height: 60
width: 60
z: 0
f338437b-2a6b-4391-ac02-652700b63cbc:
source:
id: 63e1e426-37bd-4504-aa5b-eb7362c3269d
target:
id: 818734d2-aa98-4659-99ce-1e5eec6d4e0d
z: 1