-
Notifications
You must be signed in to change notification settings - Fork 3
/
clickhouse-custom-vpc.yaml
617 lines (581 loc) · 20 KB
/
clickhouse-custom-vpc.yaml
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
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
VpcId:
Type: "AWS::EC2::VPC::Id"
Description: Exiting vpc you are going to use
PublicSubnetAId:
Type: "AWS::EC2::Subnet::Id"
Description: id of existing public subnet 1
PublicSubnetBId:
Type: "AWS::EC2::Subnet::Id"
Description: id of existing public subnet 2
PrivateSubnetAId:
Type: "AWS::EC2::Subnet::Id"
Description: id of existing private subnet 1
PrivateSubnetBId:
Type: "AWS::EC2::Subnet::Id"
Description: id of existing private subnet 1
ZookeeperInstanceType:
Type: String
Default: t2.small
Description: intance type of your zookeeper node
AllowedValues:
- t1.micro
- t2.nano
- t2.micro
- t2.small
- t2.medium
- t2.large
- m1.small
- m1.medium
- m1.large
- m1.xlarge
- m2.xlarge
- m2.2xlarge
- m2.4xlarge
- m3.medium
- m3.large
- m3.xlarge
- m3.2xlarge
- m4.large
- m4.xlarge
- m4.2xlarge
- m4.4xlarge
- m4.10xlarge
- c1.medium
- c1.xlarge
- c3.large
- c3.xlarge
- c3.2xlarge
- c3.4xlarge
- c3.8xlarge
- c4.large
- c4.xlarge
- c4.2xlarge
- c4.4xlarge
- c4.8xlarge
- g2.2xlarge
- g2.8xlarge
- r3.large
- r3.xlarge
- r3.2xlarge
- r3.4xlarge
- r3.8xlarge
- i2.xlarge
- i2.2xlarge
- i2.4xlarge
- i2.8xlarge
- d2.xlarge
- d2.2xlarge
- d2.4xlarge
- d2.8xlarge
- hi1.4xlarge
- hs1.8xlarge
- cr1.8xlarge
- cc2.8xlarge
- cg1.4xlarge
RootVolumeSize:
Type: Number
Default: "100"
Description: Root Volume size for your clickhouse instances
ClickhouseInstanceType:
Type: String
Default: t2.small
Description: intance type of your zookeeper node
AllowedValues:
- t1.micro
- t2.nano
- t2.micro
- t2.small
- t2.medium
- t2.large
- m1.small
- m1.medium
- m1.large
- m1.xlarge
- m2.xlarge
- m2.2xlarge
- m2.4xlarge
- m3.medium
- m3.large
- m3.xlarge
- m3.2xlarge
- m4.large
- m4.xlarge
- m4.2xlarge
- m4.4xlarge
- m4.10xlarge
- c1.medium
- c1.xlarge
- c3.large
- c3.xlarge
- c3.2xlarge
- c3.4xlarge
- c3.8xlarge
- c4.large
- c4.xlarge
- c4.2xlarge
- c4.4xlarge
- c4.8xlarge
- g2.2xlarge
- g2.8xlarge
- r3.large
- r3.xlarge
- r3.2xlarge
- r3.4xlarge
- r3.8xlarge
- i2.xlarge
- i2.2xlarge
- i2.4xlarge
- i2.8xlarge
- d2.xlarge
- d2.2xlarge
- d2.4xlarge
- d2.8xlarge
- hi1.4xlarge
- hs1.8xlarge
- cr1.8xlarge
- cc2.8xlarge
- cg1.4xlarge
Mappings:
RegionMap:
ap-south-1:
cami: ami-0d7e19c9a4c3d4ed5
zami: ami-0809f544f4823a3a0
eu-north-1:
cami: ami-055a231be6f12eaee
zami: ami-09fc4efac65948697
eu-west-3:
cami: ami-04f0cdd8e15063c6b
zami: ami-03ca5c2aa466c383c
eu-west-2:
cami: ami-09c614736c6dfa68c
zami: ami-04bd48d131d3f2539
eu-west-1:
cami: ami-096dc8535587cbd51
zami: ami-05262f77f4a58627b
ap-northeast-3:
cami: ami-0a432e63384a5ee99
zami: ami-062b1b56757905e68
ap-northeast-2:
cami: ami-0749409d29397fe4b
zami: ami-0afe4e17974ec8899
ap-northeast-1:
cami: ami-0987b97fbcfd9b2bc
zami: ami-0feb004f34fbeb54b
ca-central-1:
cami: ami-0de5fe695bc332d06
zami: ami-08b099378355c22e3
sa-east-1:
cami: ami-0fe26f086300f61a0
zami: ami-0ff03ff99bb749a43
ap-southeast-1:
cami: ami-0a31c033685106ac0
zami: ami-01f3d80c3cb33ce1f
ap-southeast-2:
cami: ami-05020854c833daf52
zami: ami-0bf48169eb245e48b
eu-central-1:
cami: ami-021b0a52466d3683d
zami: ami-0a560a935e9c50540
us-east-1:
cami: ami-029b7dd536a21b16f
zami: ami-0ecb3ad5c6fa31e13
us-east-2:
cami: ami-029689e34bb285558
zami: ami-0573190c8d06c5e52
us-west-1:
cami: ami-0ce8eb69d26bc273d
zami: ami-0026a926c44ea96be
us-west-2:
cami: ami-0ccfdd1e2989dfd6f
zami: ami-07f65c3bfa8f128d0
Resources:
NewKeyPair:
Type: 'AWS::EC2::KeyPair'
Properties:
KeyName: !Join ['-', ['ClickhouseKeyPairName', !Select [4, !Split ['-', !Select [2, !Split ['/', !Ref AWS::StackId]]]]]]
BastionHostSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: Enable SSH from 0.0.0.0/0
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '22'
ToPort: '22'
CidrIp: 0.0.0.0/0
VpcId: !Ref VpcId
ClickhouseSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: Enable HTTP from 0.0.0.0/0
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '9000'
ToPort: '9000'
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: '22'
ToPort: '22'
CidrIp: 0.0.0.0/0
VpcId: !Ref VpcId
ZookeeperSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: Enable HTTP from 0.0.0.0/0
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '2181'
ToPort: '2181'
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: '2888'
ToPort: '2888'
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: '3888'
ToPort: '3888'
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: '22'
ToPort: '22'
CidrIp: 0.0.0.0/0
VpcId: !Ref VpcId
ZookeeperNetworkInterface1:
DependsOn: ZookeeperNetworkInterface2
Type: AWS::EC2::NetworkInterface
Properties:
SubnetId: !Ref PrivateSubnetAId
GroupSet:
- !Ref ZookeeperSecurityGroup
ZookeeperEc2Instance1:
Type: AWS::EC2::Instance
DependsOn: ZookeeperNetworkInterface1
Properties:
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", "zami"]
KeyName: !Ref NewKeyPair
InstanceType: !Ref ZookeeperInstanceType
UserData:
Fn::Base64 : !Sub
- |
#!/bin/bash -xe
echo "hello-world"
sudo sed -i -r "s/server-1-ip/0.0.0.0/" /usr/local/zookeeper/conf/zoo.cfg
sudo sed -i -r "s/server-2-ip/${server_2}/" /usr/local/zookeeper/conf/zoo.cfg
sudo sed -i -r "s/server-3-ip/${server_3}/" /usr/local/zookeeper/conf/zoo.cfg
sudo ZK_SERVER_HEAP=128 /usr/local/zookeeper/bin/zkServer.sh start
- server_2: !GetAtt ZookeeperNetworkInterface2.PrimaryPrivateIpAddress
server_3: !GetAtt ZookeeperNetworkInterface3.PrimaryPrivateIpAddress
NetworkInterfaces:
- NetworkInterfaceId: !Ref ZookeeperNetworkInterface1
DeviceIndex: "0"
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeType: gp2
VolumeSize: !Ref RootVolumeSize
DeleteOnTermination: true
Encrypted: true
Tags:
- Key: Name
Value: signoz-zookeeper-1
ZookeeperNetworkInterface2:
Type: AWS::EC2::NetworkInterface
DependsOn: ZookeeperNetworkInterface3
Properties:
SubnetId: !Ref PrivateSubnetBId
GroupSet:
- !Ref ZookeeperSecurityGroup
ZookeeperEc2Instance2:
Type: AWS::EC2::Instance
DependsOn: ZookeeperNetworkInterface2
Properties:
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", "zami"]
KeyName: !Ref NewKeyPair
InstanceType: !Ref ZookeeperInstanceType
UserData:
Fn::Base64 : !Sub
- |
#!/bin/bash -xe
echo "hello-world"
sudo sed -i -r "s/server-1-ip/${server_1}/" /usr/local/zookeeper/conf/zoo.cfg
sudo sed -i -r "s/server-2-ip/0.0.0.0/" /usr/local/zookeeper/conf/zoo.cfg
sudo sed -i -r "s/server-3-ip/${server_3}/" /usr/local/zookeeper/conf/zoo.cfg
sudo sed -i -r "s/1/2/" /var/lib/zookeeper/myid
sudo ZK_SERVER_HEAP=128 /usr/local/zookeeper/bin/zkServer.sh start
- server_1: !GetAtt ZookeeperNetworkInterface1.PrimaryPrivateIpAddress
server_3: !GetAtt ZookeeperNetworkInterface3.PrimaryPrivateIpAddress
NetworkInterfaces:
- NetworkInterfaceId: !Ref ZookeeperNetworkInterface2
DeviceIndex: "0"
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeType: gp2
VolumeSize: !Ref RootVolumeSize
DeleteOnTermination: true
Encrypted: true
Tags:
- Key: Name
Value: signoz-zookeeper-2
ZookeeperNetworkInterface3:
Type: AWS::EC2::NetworkInterface
Properties:
SubnetId: !Ref PrivateSubnetAId
GroupSet:
- !Ref ZookeeperSecurityGroup
ZookeeperEc2Instance3:
Type: AWS::EC2::Instance
DependsOn: ZookeeperNetworkInterface3
Properties:
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", "zami"]
KeyName: !Ref NewKeyPair
InstanceType: !Ref ZookeeperInstanceType
UserData:
Fn::Base64 : !Sub
- |
#!/bin/bash -xe
echo "hello-world"
sudo sed -i -r "s/server-1-ip/${server_1}/" /usr/local/zookeeper/conf/zoo.cfg
sudo sed -i -r "s/server-2-ip/${server_2}/" /usr/local/zookeeper/conf/zoo.cfg
sudo sed -i -r "s/server-3-ip/0.0.0.0/" /usr/local/zookeeper/conf/zoo.cfg
sudo sed -i -r "s/1/3/" /var/lib/zookeeper/myid
sudo ZK_SERVER_HEAP=128 /usr/local/zookeeper/bin/zkServer.sh start
- server_2: !GetAtt ZookeeperNetworkInterface2.PrimaryPrivateIpAddress
server_1: !GetAtt ZookeeperNetworkInterface1.PrimaryPrivateIpAddress
NetworkInterfaces:
- NetworkInterfaceId: !Ref ZookeeperNetworkInterface3
DeviceIndex: "0"
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeType: gp2
VolumeSize: !Ref RootVolumeSize
DeleteOnTermination: true
Encrypted: true
Tags:
- Key: Name
Value: signoz-zookeeper-3
S3AccessRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: ec2.amazonaws.com
Action: sts:AssumeRole
Policies:
- PolicyName: !Join ['-', ['s3fullacess', !Select [4, !Split ['-', !Select [2, !Split ['/', !Ref AWS::StackId]]]]]]
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: s3:*
Resource: '*'
S3InstanceProfile:
Type: AWS::IAM::InstanceProfile
Properties:
Path: /
Roles:
- !Ref S3AccessRole
Ec2NetworkInterfaceClickhouse1:
DependsOn: ZookeeperEc2Instance1
Type: AWS::EC2::NetworkInterface
Properties:
SubnetId: !Ref PrivateSubnetAId
GroupSet:
- !Ref ClickhouseSecurityGroup
BackupBucket1:
Type: AWS::S3::Bucket
Description: Bucket to store clickhouse buckets
EC2InstanceClickhouse1:
Type: AWS::EC2::Instance
DependsOn: Ec2NetworkInterfaceClickhouse1
Properties:
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", "cami"]
KeyName: !Ref NewKeyPair
IamInstanceProfile: !Ref S3InstanceProfile
InstanceType: !Ref ClickhouseInstanceType
UserData:
Fn::Base64 : !Sub
- |
#!/bin/bash -xe
echo "hello-world"
sudo sed -i -r "s/shard-1-replica-1/${server_1}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/shard-2-replica-1/${server_2}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/shard-3-replica-1/${server_3}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/zookeeper-1-host/${z_1}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/zookeeper-2-host/${z_2}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/zookeeper-3-host/${z_3}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/shard-num/${s_num}/" /etc/clickhouse-server/config.d/macros.xml
sudo sed -i -r "s/replica-num/${r_num}/" /etc/clickhouse-server/config.d/macros.xml
sudo sed -i -r "s/bucket_name/${bucket_name}/" /etc/clickhouse-backup/config.yml
sudo sed -i -r "s/bucket_region/${bucket_region}/" /etc/clickhouse-backup/config.yml
sudo mv /etc/cron.daily/clickhouse-backup.sh /etc/cron.daily/clickhouse-backup
sudo systemctl restart clickhouse-server
- server_1: !GetAtt Ec2NetworkInterfaceClickhouse1.PrimaryPrivateIpAddress
server_2: !GetAtt Ec2NetworkInterfaceClickhouse2.PrimaryPrivateIpAddress
server_3: !GetAtt Ec2NetworkInterfaceClickhouse3.PrimaryPrivateIpAddress
z_1: !GetAtt ZookeeperEc2Instance1.PrivateDnsName
z_2: !GetAtt ZookeeperEc2Instance2.PrivateDnsName
z_3: !GetAtt ZookeeperEc2Instance3.PrivateDnsName
s_num: 1
r_num: 1
bucket_name: !Ref BackupBucket1
bucket_region: !Ref "AWS::Region"
NetworkInterfaces:
- NetworkInterfaceId: !Ref Ec2NetworkInterfaceClickhouse1
DeviceIndex: "0"
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeType: gp2
VolumeSize: !Ref RootVolumeSize
DeleteOnTermination: true
Encrypted: true
Tags:
- Key: Name
Value: signoz-clickhouse-1
Ec2NetworkInterfaceClickhouse2:
DependsOn: Ec2NetworkInterfaceClickhouse1
Type: AWS::EC2::NetworkInterface
Properties:
SubnetId: !Ref PrivateSubnetBId
GroupSet:
- !Ref ClickhouseSecurityGroup
BackupBucket2:
Type: AWS::S3::Bucket
Description: Bucket to store clickhouse backups
EC2InstanceClickhouse2:
Type: AWS::EC2::Instance
DependsOn: EC2InstanceClickhouse1
Properties:
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", "cami"]
IamInstanceProfile: !Ref S3InstanceProfile
InstanceType: !Ref ClickhouseInstanceType
KeyName: !Ref NewKeyPair
UserData:
Fn::Base64 : !Sub
- |
#!/bin/bash -xe
echo "hello-world"
sudo sed -i -r "s/shard-1-replica-1/${server_1}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/shard-2-replica-1/${server_2}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/shard-3-replica-1/${server_3}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/zookeeper-1-host/${z_1}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/zookeeper-2-host/${z_2}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/zookeeper-3-host/${z_3}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/shard-num/${s_num}/" /etc/clickhouse-server/config.d/macros.xml
sudo sed -i -r "s/replica-num/${r_num}/" /etc/clickhouse-server/config.d/macros.xml
sudo sed -i -r "s/bucket_name/${bucket_name}/" /etc/clickhouse-backup/config.yml
sudo sed -i -r "s/bucket_region/${bucket_region}/" /etc/clickhouse-backup/config.yml
sudo mv /etc/cron.daily/clickhouse-backup.sh /etc/cron.daily/clickhouse-backup
sudo systemctl restart clickhouse-server
- server_1: !GetAtt Ec2NetworkInterfaceClickhouse1.PrimaryPrivateIpAddress
server_2: !GetAtt Ec2NetworkInterfaceClickhouse2.PrimaryPrivateIpAddress
server_3: !GetAtt Ec2NetworkInterfaceClickhouse3.PrimaryPrivateIpAddress
z_1: !GetAtt ZookeeperEc2Instance1.PrivateDnsName
z_2: !GetAtt ZookeeperEc2Instance2.PrivateDnsName
z_3: !GetAtt ZookeeperEc2Instance3.PrivateDnsName
s_num: 2
r_num: 1
bucket_name: !Ref BackupBucket2
bucket_region: !Ref "AWS::Region"
NetworkInterfaces:
- NetworkInterfaceId: !Ref Ec2NetworkInterfaceClickhouse2
DeviceIndex: "0"
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeType: gp2
VolumeSize: !Ref RootVolumeSize
DeleteOnTermination: true
Encrypted: true
Tags:
- Key: Name
Value: signoz-clickhouse-2
Ec2NetworkInterfaceClickhouse3:
DependsOn: Ec2NetworkInterfaceClickhouse2
Type: AWS::EC2::NetworkInterface
Properties:
SubnetId: !Ref PrivateSubnetAId
GroupSet:
- !Ref ClickhouseSecurityGroup
BackupBucket3:
Type: AWS::S3::Bucket
Description: Bucket to store clickhouse backups
EC2InstanceClickhouse3:
Type: AWS::EC2::Instance
DependsOn: EC2InstanceClickhouse2
Properties:
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", "cami"]
KeyName: !Ref NewKeyPair
IamInstanceProfile: !Ref S3InstanceProfile
InstanceType: !Ref ClickhouseInstanceType
UserData:
Fn::Base64 : !Sub
- |
#!/bin/bash -xe
echo "hello-world"
sudo sed -i -r "s/shard-1-replica-1/${server_1}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/shard-2-replica-1/${server_2}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/shard-3-replica-1/${server_3}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/zookeeper-1-host/${z_1}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/zookeeper-2-host/${z_2}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/zookeeper-3-host/${z_3}/" /etc/clickhouse-server/config.d/cluster.xml
sudo sed -i -r "s/shard-num/${s_num}/" /etc/clickhouse-server/config.d/macros.xml
sudo sed -i -r "s/replica-num/${r_num}/" /etc/clickhouse-server/config.d/macros.xml
sudo sed -i -r "s/bucket_name/${bucket_name}/" /etc/clickhouse-backup/config.yml
sudo sed -i -r "s/bucket_region/${bucket_region}/" /etc/clickhouse-backup/config.yml
sudo mv /etc/cron.daily/clickhouse-backup.sh /etc/cron.daily/clickhouse-backup
sudo systemctl restart clickhouse-server
- server_1: !GetAtt Ec2NetworkInterfaceClickhouse1.PrimaryPrivateIpAddress
server_2: !GetAtt Ec2NetworkInterfaceClickhouse2.PrimaryPrivateIpAddress
server_3: !GetAtt Ec2NetworkInterfaceClickhouse3.PrimaryPrivateIpAddress
z_1: !GetAtt ZookeeperEc2Instance1.PrivateDnsName
z_2: !GetAtt ZookeeperEc2Instance2.PrivateDnsName
z_3: !GetAtt ZookeeperEc2Instance3.PrivateDnsName
s_num: 3
r_num: 1
bucket_name: !Ref BackupBucket3
bucket_region: !Ref "AWS::Region"
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeType: gp2
VolumeSize: !Ref RootVolumeSize
DeleteOnTermination: true
Encrypted: true
NetworkInterfaces:
- NetworkInterfaceId: !Ref Ec2NetworkInterfaceClickhouse3
DeviceIndex: "0"
Tags:
- Key: Name
Value: signoz-clickhouse-3
NetworkInterfaces:
- NetworkInterfaceId: !Ref Ec2NetworkInterfaceClickhouse3
DeviceIndex: "0"
Tags:
- Key: Name
Value: signoz-clickhouse-3
Outputs:
VpcId:
Description: Id of the vpc created by cloudformation
Value: !Ref VpcId
ClickhouseDnsHost:
Description: public dns of the ec2 instance
Value: !GetAtt EC2InstanceClickhouse3.PrivateDnsName
PublicSubNetAId:
Description: Id of public subnet A
Value: !Ref PublicSubnetAId
PublicSubNetBId:
Description: Id of public subnet b
Value: !Ref PublicSubnetBId
PrivateSubNetAId:
Description: Id of private subnet A
Value: !Ref PrivateSubnetAId
PrivateSubNetBId:
Description: Id of public subnet A
Value: !Ref PrivateSubnetBId