Centos7 leofs集群搭建和测试

LeoFS是一个非结构化的Web对象存储和高可用的,分布式的,最终一致的存储系统,以下为两三年前站长测试时留下的笔记,可能与目前最新版本有一定区别
基本规划

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
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
Manager
IP: 10.39.1.23, 10.39.1.24
Name: manager_0@10.39.1.23, manager_1@10.39.1.24

Gateway
IP: 10.39.1.28
Name: gateway_0@10.39.1.28

Storage
IP: 10.39.1.25 .. 10.39.1.26  ... 10.39.1.27
Name: storage_01@10.39.1.25 .. storage_02@10.39.1.26...storage_02@10.39.1.27

首先在10.39.1.23上配置
yum install epel-release -y
yum install ansible -y

配置ansible
vi /etc/ansible/hosts
--------------------------------------------
添加各IP服务器
其中本机为:
localhost

增加内容
[targets]
localhost ansible_connection=local

--------------------------------------------
执行ansible

ansible leofs -m shell -a "yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf  libuuid-devel cmake check check-devel   wget curl git gcc* vim nc -y "


修改主机名以及hosts
10.39.1.23       leofs_01
10.39.1.24       leofs_02
10.39.1.25       storage_01
10.39.1.26       storage_02
10.39.1.27       storage_03
10.39.1.28       gw_01

生成key  
ssh-keygen
ansible 推送key 到其他服务器
ansible all -m authorized_key -a "user=root  key='{{ lookup('file','~/.ssh/id_rsa.pub')}}'"  

编辑所有服务器配置主机名
vim /etc/hostname
vim /etc/hosts


验证

ansible leofs -m shell  -a "hostname"

ansible leofs -m shell  -a "cat /etc/hosts"  


下载leofs 包

http://leo-project.net/leofs/download.html  


下载centos 7 1.3.2.1 最新rpm包

将rpm copy 到其他服务器

ansible all -m copy -a 'src=~/leofs-1.3.2.1-1.erl-18.3.el7.x86_64.rpm dest=/opt'

ansible all -m shell -a 'ls -l /opt'  

ansible all -m shell -a 'cd /opt/; yum install leofs-1.3.2.1-1.erl-18.3.el7.x86_64.rpm -y'  


# 存储节点安装

ansible leofs_storage -m shell -a "yum --enablerepo=centosplus install kmod-xfs xfsprogs xfsprogs-devel -y"


查看安装目录是否全部安装

ansible all -m shell -a 'ls -l /usr/local/leofs'  

   配置leofs  
   10.39.1.23  配置manger0

   manager0 中会配置一致性的级别和集群的id 以及名称

   leofs 一致性级别配置参考

   #leofs 集群一致性级别配置

   相关资料参考 http://leo-project.net/leofs/docs/configuration/configuration_1.html#system-configuration-label  

   A reference consistency level

   LevelConfiguration

   Lown = 3, r = 1, w = 1, d = 1

   Middlen = 3, [r = 1 | r = 2], w = 2, d = 2

   Highn = 3, [r = 2 | r = 3], w = 3, d = 3


  cp /usr/local/leofs/1.3.2.1/leo_manager_0/etc/leo_manager.conf /usr/local/leofs/1.3.2.1/leo_manager_0/etc/leo_manager.conf.bak
  vim  /usr/local/leofs/1.3.2.1/leo_manager_0/etc/leo_manager.conf

  manager.partner = manager_1@10.39.1.24

  system.dc_id = dc_1

  system.cluster_id = leofs_cluster

  consistency.num_of_replicas = 3

  consistency.write = 1

  consistency.read = 1

  consistency.delete = 1

  consistency.rack_aware_replicas = 0


  nodename = manager_0@10.39.1.23


10.39.1.24 manger1 配置

cp /usr/local/leofs/1.3.2.1/leo_manager_1/etc/leo_manager.conf /usr/local/leofs/1.3.2.1/leo_manager_1/etc/leo_manager.conf.bak

vim  /usr/local/leofs/1.3.2.1/leo_manager_1/etc/leo_manager.conf  

manager.partner = manager_0@10.39.1.23

nodename = manager_1@10.39.1.24



10.39.1.25   storage_01 配置

返回到10.39.1.23 上使用ansible 对配置文件进行备份

ansible leofs_storage -m shell -a "cp /usr/local/leofs/1.3.2.1/leo_storage/etc/leo_storage.conf /usr/local/leofs/1.3.2.1/leo_storage/etc/leo_storage.conf.bak "  



leofs 建议使用xfs,因为xfs I/O对大文件支持比较好

添加一块硬盘并且格式化为xfs 文件系统


fdisl /dev/vdc  

n

p

w


mkfs.xfs /dev/vdc1

vim   /usr/local/leofs/1.3.2.1/leo_storage/etc/leo_storage.conf

managers = [manager_0@10.39.1.23, manager_1@10.39.1.24]

obj_containers.path = [/data/leofs]
obj_containers.num_of_containers = [8]


#读写参数的一些设置

磁盘的一些设置

##  Watchdog.DISK

##

## Is disk-watchdog enabled - default:false
watchdog.disk.is_enabled = false

## disk - raised error times
watchdog.disk.raised_error_times = 5

## disk - watch interval - default:1sec
watchdog.disk.interval = 10

## Threshold use(%) of a target disk's capacity - defalut:85%
watchdog.disk.threshold_disk_use = 85

## Threshold disk utilization(%) - defalut:90%
watchdog.disk.threshold_disk_util = 90

## Threshold disk read kb/sec - defalut:98304(KB) = 96MB
#watchdog.disk.threshold_disk_rkb = 98304
#131072kb=128MB
watchdog.disk.threshold_disk_rkb = 131072

## Threshold disk write kb/sec - defalut:98304(KB) = 96MB
#watchdog.disk.threshold_disk_wkb = 98304
#131072(kb)=128MB
watchdog.disk.threshold_disk_wkb = 131072
nodename = storage_01@10.39.1.25


配置也可以参考

leofs 存储默认可以设置多个

## e.g. Case of plural pathes

## obj_containers.path = [/var/leofs/avs/1, /var/leofs/avs/2]

## obj_containers.num_of_containers = [32, 64]


10.39.1.26   storage02 配置

mkfs.xfs /dev/vdc1
vim  /usr/local/leofs/1.3.2.1/leo_storage/etc/leo_storage.conf

managers = [manager_0@10.39.1.23, manager_1@10.39.1.24]

obj_containers.path = [/data/leofs]

obj_containers.num_of_containers = [8]

nodename = storage_02@10.39.1.26


10.39.1.27   storage03 配置

mkfs.xfs /dev/vdc1  

vim   /usr/local/leofs/1.3.2.1/leo_storage/etc/leo_storage.conf

managers = [manager_0@10.39.1.23, manager_1@10.39.1.24]

obj_containers.path = [/data/leofs]

obj_containers.num_of_containers = [8]

nodename = storage_03@10.39.1.27


返回到10.39.1.23 上使用ansible 批量执行

ansible leofs_storage -m shell -a "mkdir /data/leofs -p "
ansible leofs_storage -m shell -a "ls /data/"
ansible leofs_storage -m shell -a "mount /dev/vdc1 /data/leofs"
ansible leofs_storage -m shell -a "df -h"

echo "/dev/vdc1   /data/leofs   xfs   noatime,nodiratime,osyncisdsync 0 0"   >> /etc/fstab  

ansible leofs_storage -m shell -a 'echo "/dev/vdc1   /data/leofs   xfs   noatime,nodiratime,osyncisdsync 0 0"   >> /etc/fstab'



将storage01 02  03 重启  

查看存储是否挂载成功
ansible leofs_storage -m shell -a "df -h"  

gw_01 10.39.1.28 配置

网关配置协议  端口   网关的缓存大小
vim   /usr/local/leofs/1.3.2.1/leo_gateway/etc/leo_gateway.conf  
managers = [manager_0@10.39.1.23, manager_1@10.39.1.24]
protocol = s3

http.port = 8080

cache.cache_ram_capacity = 268435456

cache.cache_disc_capacity = 0

cache.cache_expire = 300

cache.cache_max_content_len = 1048576

nodename = gateway_01@10.39.1.28



# 网关配置线程池

## Large Object Handler - put worker pool size

large_object.put_worker_pool_size = 64

## Large Object Handler - put worker buffer size

large_object.put_worker_buffer_size = 32

## Memory cache capacity in bytes

cache.cache_ram_capacity = 0

## Disk cache capacity in bytes

cache.cache_disc_capacity = 0

## When the length of the object exceeds this value, store the object on disk

cache.cache_disc_threshold_len = 1048576

## Directory for the disk cache data

cache.cache_disc_dir_data = ./cache/data


## Directory for the disk cache journal

cache.cache_disc_dir_journal = ./cache/journal



启动顺序

Order of server launch

Manager-master

Manager-slave

Storage nodes

Gateway(s)



10.39.1.23  manager0

/usr/local/leofs/1.3.2.1/leo_manager_0/bin/leo_manager start  

/usr/local/leofs/1.3.2.1/leo_manager_0/bin/leo_manager ping  

pong  

10.39.1.24  manager1

/usr/local/leofs/1.3.2.1/leo_manager_1/bin/leo_manager start  

/usr/local/leofs/1.3.2.1/leo_manager_1/bin/leo_manager ping

pong


10.39.1.25  storage01

/usr/local/leofs/1.3.2.1/leo_storage/bin/leo_storage start  

/usr/local/leofs/1.3.2.1/leo_storage/bin/leo_storage ping

pong


10.39.1.26  storage02

/usr/local/leofs/1.3.2.1/leo_storage/bin/leo_storage start


/usr/local/leofs/1.3.2.1/leo_storage/bin/leo_storage ping

pong



10.39.1.27  storage03

/usr/local/leofs/1.3.2.1/leo_storage/bin/leo_storage start

/usr/local/leofs/1.3.2.1/leo_storage/bin/leo_storage ping

pong

 


查看存储的启动信息

ansible leofs_storage -m shell -a "ls -l /data/leofs"

10.39.1.26 | SUCCESS | rc=0 >>

总用量 12

drwxr-xr-x  2 root root 4096 3月  30 16:00 log

drwxr-xr-x 10 root root 4096 3月  30 15:24 metadata

drwxr-xr-x  2 root root  310 3月  30 15:18 object

drwxr-xr-x  2 root root 4096 3月  30 15:24 state



10.39.1.25 | SUCCESS | rc=0 >>

总用量 12

drwxr-xr-x  2 root root 4096 3月  30 16:00 log

drwxr-xr-x 10 root root 4096 3月  30 15:23 metadata

drwxr-xr-x  2 root root  310 3月  30 15:04 object

drwxr-xr-x  2 root root 4096 3月  30 15:23 state



10.39.1.27 | SUCCESS | rc=0 >>

总用量 4

drwxr-xr-x  2 root root 4096 3月  30 16:00 log

drwxr-xr-x 10 root root  246 3月  30 15:19 metadata

drwxr-xr-x  2 root root  310 3月  30 15:19 object



在10.39.1.23 上执行查看集群的状态

集群的状态查询是经过nmap 通信查询的, 需要在centos 下安装nc

ansible leofs -m shell -a "yum install nc -y "  

/usr/local/leofs/1.3.2.1/leofs-adm status

/usr/local/leofs/1.3.2.1/leofs-adm status

 [System Confiuration]

-----------------------------------+----------

 Item                              | Value    

-----------------------------------+----------

 Basic/Consistency level

-----------------------------------+----------

                    system version | 1.3.2

                        cluster Id | leofs_cluster

                             DC Id | dc_1

                    Total replicas | 3

          number of successes of R | 1

          number of successes of W | 1

          number of successes of D | 1

 number of rack-awareness replicas | 0

                         ring size | 2^128

-----------------------------------+----------

 Multi DC replication settings

-----------------------------------+----------

        max number of joinable DCs | 2

           number of replicas a DC | 1

-----------------------------------+----------

 Manager RING hash

-----------------------------------+----------

                 current ring-hash |

                previous ring-hash |

-----------------------------------+----------



 [State of Node(s)]

-------+----------------------------+--------------+----------------+----------------+----------------------------

 type  |            node            |    state     |  current ring  |   prev ring    |          updated at        

-------+----------------------------+--------------+----------------+----------------+----------------------------

  S    | storage_01@10.39.1.25      | attached     |                |                | 2017-03-30 15:24:56 +0800

  S    | storage_02@10.39.1.26      | attached     |                |                | 2017-03-30 15:24:43 +0800

  S    | storage_03@10.39.1.27      | attached     |                |                | 2017-03-30 15:19:22 +0800

-------+----------------------------+--------------+----------------+----------------+----------------------------



10.39.1.28  

启动网关

/usr/local/leofs/1.3.2.1/leo_gateway/bin/leo_gateway start  

/usr/local/leofs/1.3.2.1/leo_gateway/bin/leo_gateway ping  

pong


10.39.1.23 leofs 存储系统启动

/usr/local/leofs/1.3.2.1/leofs-adm start

Generating RING...

Generated RING

OK  33% - storage_01@10.39.1.25

OK  67% - storage_03@10.39.1.27

OK 100% - storage_02@10.39.1.26

OK


 /usr/local/leofs/1.3.2.1/leofs-adm status

 [System Confiuration]

-----------------------------------+----------

 Item                              | Value    

-----------------------------------+----------

 Basic/Consistency level

-----------------------------------+----------

                    system version | 1.3.2

                        cluster Id | leofs_cluster

                             DC Id | dc_1

                    Total replicas | 3

          number of successes of R | 1

          number of successes of W | 1

          number of successes of D | 1

 number of rack-awareness replicas | 0

                         ring size | 2^128

-----------------------------------+----------

 Multi DC replication settings

-----------------------------------+----------

        max number of joinable DCs | 2

           number of replicas a DC | 1

-----------------------------------+----------

 Manager RING hash

-----------------------------------+----------

                 current ring-hash |

                previous ring-hash |

-----------------------------------+----------



 [State of Node(s)]

-------+----------------------------+--------------+----------------+----------------+----------------------------

 type  |            node            |    state     |  current ring  |   prev ring    |          updated at        

-------+----------------------------+--------------+----------------+----------------+----------------------------

  S    | storage_01@10.39.1.25      | running      | 79e0dbc4       | 79e0dbc4       | 2017-03-30 15:29:17 +0800

  S    | storage_02@10.39.1.26      | running      | 79e0dbc4       | 79e0dbc4       | 2017-03-30 15:29:17 +0800

  S    | storage_03@10.39.1.27      | running      | 79e0dbc4       | 79e0dbc4       | 2017-03-30 15:29:17 +0800

  G    | gateway_01@10.39.1.28      | running      | 79e0dbc4       | 79e0dbc4       | 2017-03-30 15:29:18 +0800

-------+----------------------------+--------------+----------------+----------------+----------------------------


leofs 对象存储的配置和查询

s3-api 命令使用

http://leo-project.net/leofs/docs/admin_guide/admin_guide_8.html


用户查询

get-users

/usr/local/leofs/1.3.2.1/leofs-adm get-users

user_id     | role_id | access_key_id          | created_at                

------------+---------+------------------------+---------------------------

_test_leofs | 9       | 05236                  | 2017-03-30 15:03:54 +0800



删除默认的用户

delete-user <user-id>

/usr/local/leofs/1.3.2.1/leofs-adm delete-user _test_leofs

OK


创建用户

create-user <user-id> <password>

/usr/local/leofs/1.3.2.1/leofs-adm create-user test test

  access-key-id: 919ca38e3fb34085b94a

  secret-access-key: 387d7f32546982131e41355e1adbcae1a9b08bec



/usr/local/leofs/1.3.2.1/leofs-adm get-users

user_id | role_id | access_key_id          | created_at                

--------+---------+------------------------+---------------------------

test    | 1       | 919ca38e3fb34085b94a   | 2017-03-30 15:45:41 +0800



endpoint  

/usr/local/leofs/1.3.2.1/leofs-adm add-endpoint 10.39.1.28

OK



/usr/local/leofs/1.3.2.1/leofs-adm get-endpoints

endpoint         | created at                

-----------------+---------------------------

10.39.1.28       | 2017-03-30 15:49:14 +0800

localhost        | 2017-03-30 15:03:54 +0800

s3.amazonaws.com | 2017-03-30 15:03:54 +0800



add-bucket <bcuket> <access-key-id>



/usr/local/leofs/1.3.2.1/leofs-adm add-bucket abc 919ca38e3fb34085b94a

OK



/usr/local/leofs/1.3.2.1/leofs-adm get-buckets

cluster id    | bucket   | owner  | permissions      | redundancy method            | created at                

--------------+----------+--------+------------------+------------------------------+---------------------------

leofs_cluster | abc      | test   | Me(full_control) | copy, {n:3, w:1, r:1, d:1}   | 2017-03-30 15:51:43 +0800


get-bucket <access-key-id>



权限

/usr/local/leofs/1.3.2.1/leofs-adm  update-acl abc 919ca38e3fb34085b94a public-read-write

OK




查看存储节点的磁盘信息

/usr/local/leofs/1.3.2.1/leofs-adm  du detail storage_01@10.39.1.25

[du(storage stats)]

                file path: /data/leofs/object/0.avs

 active number of objects: 0

  total number of objects: 0

   active size of objects: 0

    total size of objects: 0

     ratio of active size: 0%

    last compaction start: ____-__-__ __:__:__

      last compaction end: ____-__-__ __:__:__

                 duration: 0s

                   result: ''



                file path: /data/leofs/object/1.avs

 active number of objects: 0

  total number of objects: 0

   active size of objects: 0

    total size of objects: 0

     ratio of active size: 0%

    last compaction start: ____-__-__ __:__:__

      last compaction end: ____-__-__ __:__:__

                 duration: 0s

                   result: ''



                file path: /data/leofs/object/2.avs

 active number of objects: 0

  total number of objects: 0

   active size of objects: 0

    total size of objects: 0

     ratio of active size: 0%

    last compaction start: ____-__-__ __:__:__

      last compaction end: ____-__-__ __:__:__

                 duration: 0s

                   result: ''



                file path: /data/leofs/object/3.avs

 active number of objects: 0

  total number of objects: 0

   active size of objects: 0

    total size of objects: 0

     ratio of active size: 0%

    last compaction start: ____-__-__ __:__:__

      last compaction end: ____-__-__ __:__:__

                 duration: 0s

                   result: ''



                file path: /data/leofs/object/4.avs

 active number of objects: 0

  total number of objects: 0

   active size of objects: 0

    total size of objects: 0

     ratio of active size: 0%

    last compaction start: ____-__-__ __:__:__

      last compaction end: ____-__-__ __:__:__

                 duration: 0s

                   result: ''



                file path: /data/leofs/object/5.avs

 active number of objects: 0

  total number of objects: 0

   active size of objects: 0

    total size of objects: 0

     ratio of active size: 0%

    last compaction start: ____-__-__ __:__:__

      last compaction end: ____-__-__ __:__:__

                 duration: 0s

                   result: ''



                file path: /data/leofs/object/6.avs

 active number of objects: 0

  total number of objects: 0

   active size of objects: 0

    total size of objects: 0

     ratio of active size: 0%

    last compaction start: ____-__-__ __:__:__

      last compaction end: ____-__-__ __:__:__

                 duration: 0s

                   result: ''



                file path: /data/leofs/object/7.avs

 active number of objects: 0

  total number of objects: 0

   active size of objects: 0

    total size of objects: 0

     ratio of active size: 0%

    last compaction start: ____-__-__ __:__:__

      last compaction end: ____-__-__ __:__:__

                 duration: 0s

                   result: ''


 /usr/local/leofs/1.3.2.1/leofs-adm  status  storage_01@10.39.1.25

--------------------------------------+--------------------------------------

                Item                  |                 Value                

--------------------------------------+--------------------------------------

 Config-1: basic

--------------------------------------+--------------------------------------

                              version | 1.3.1

                     number of vnodes | 168

                    object containers | - path:[/data/leofs], # of containers:8

                        log directory | ./log/erlang

                            log level | info

--------------------------------------+--------------------------------------

 Config-2: watchdog

--------------------------------------+--------------------------------------

 [rex(rpc-proc)]                      |

                    check interval(s) | 10

               threshold mem capacity | 33554432

--------------------------------------+--------------------------------------

 [cpu]                                |

                     enabled/disabled | disabled

                    check interval(s) | 10

               threshold cpu load avg | 5.0

                threshold cpu util(%) | 100

--------------------------------------+--------------------------------------

 [disk]                               |

                     enabled/disalbed | disabled

                    check interval(s) | 10

                threshold disk use(%) | 85

               threshold disk util(%) | 90

                    threshold rkb(kb) | 131072

                    threshold wkb(kb) | 131072

--------------------------------------+--------------------------------------

 Config-3: message-queue

--------------------------------------+--------------------------------------

                   number of procs/mq | 8

        number of batch-procs of msgs | max:3000, regular:1600

   interval between batch-procs (ms)  | max:3000, regular:500

--------------------------------------+--------------------------------------

 Config-4: autonomic operation

--------------------------------------+--------------------------------------

 [auto-compaction]                    |

                     enabled/disabled | disabled

        warning active size ratio (%) | 70

      threshold active size ratio (%) | 60

             number of parallel procs | 1

                        exec interval | 3600

--------------------------------------+--------------------------------------

 Config-5: data-compaction

--------------------------------------+--------------------------------------

  limit of number of compaction procs | 4

        number of batch-procs of objs | max:1500, regular:1000

   interval between batch-procs (ms)  | max:3000, regular:500

--------------------------------------+--------------------------------------

 Status-1: RING hash

--------------------------------------+--------------------------------------

                    current ring hash | 79e0dbc4

                   previous ring hash | 79e0dbc4

--------------------------------------+--------------------------------------

 Status-2: Erlang VM

--------------------------------------+--------------------------------------

                           vm version | 7.3.1.2

                      total mem usage | 37035408

                     system mem usage | 20786136

                      procs mem usage | 16258552

                        ets mem usage | 5229136

                                procs | 560/1048576

                          kernel_poll | true

                     thread_pool_size | 32

--------------------------------------+--------------------------------------

 Status-3: Number of messages in MQ

--------------------------------------+--------------------------------------

                 replication messages | 0

                  vnode-sync messages | 0

                   rebalance messages | 0

--------------------------------------+--------------------------------------


性能压测

leofs 性能测试工具  basho_bench

https://github.com/basho/basho_bench



10.39.1.23  安装

安装依赖

1. Install libatomic

##

$ wget http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-7.4.4.tar.gz

$ tar xzvf libatomic_ops-7.4.4.tar.gz

$ cd libatomic_ops-7.4.4

$ ./configure --prefix=/usr/local

$ make

$ sudo make install



##

## 2. Install Erlang (18.3)

##

$ wget http://erlang.org/download/otp_src_18.3.tar.gz

$ tar xzf otp_src_18.3.tar.gz

$ cd otp_src_18.3

$ ./configure --prefix=/usr/local/erlang/18.3 \

              --enable-smp-support \

              --enable-m64-build \

              --enable-halfword-emulator \

              --enable-kernel-poll \

              --without-javac \

              --disable-native-libs \

              --disable-hipe \

              --disable-sctp \

              --enable-threads \

              --with-libatomic_ops=/usr/local

$ make

$ sudo make install



##

## 3. Set PATH

##

$ vi ~/.profile

    ## append the follows:

    export ERL_HOME=/usr/local/erlang/18.3

    export PATH=$PATH:$ERL_HOME/bin



$ source ~/.profile







安装性能测试工具

git clone https://github.com/leo-project/basho_bench.git

cd basho_bench/

make all



# make all 的时候使用的git 有时候拉取依赖会报错,使用https 就好

批量替换git deps 目录下的所有的rebar.confg 配置文件git 修改为https

find deps -name rebar.config -type f -exec sed -i 's/git:\/\//https:\/\//g' {} +

make all  





性能压测测试文件  

16kb 文件压测

vim   16file.conf  

{mode,      max}.

{duration,   10}.

{concurrent, 50}.



{driver, basho_bench_driver_leofs}.

{code_paths, ["deps/ibrowse"]}.



{http_raw_ips, ["10.39.1.28"]}. %% able to set plural nodes

{http_raw_port, 8080}. %% default: 8080

{http_raw_path, "/abc"}.

%% {http_raw_path, "/${BUCKET}"}.



{key_generator,   {partitioned_sequential_int, 660000}}. %% 请求的次数

{value_generator, {fixed_bin, 16384}}. %% 16KB

{operations, [{put,1}]}.               %% PUT:100%

%%{operations, [{put,1}, {get, 4}]}.   %% PUT:20%, GET:80%

{check_integrity, false}.



660000x16kb=10GB  



安装nmon 收集信息

ansible leofs -m shell -a "yum install wget https://raw.githubusercontent.com/hambuergaer/nmon-packages/master/nmon-rhel7-1.0-1.x86_64.rpm -y "

ansible leofs -m shell -a "mkdir /nmon "  



10 分钟

nmon 使用参数

-s  表示秒级采集一次数据

-c  表示采集收的次数

-m  表示生成数据文件的路径

-f  表示生成数据文件名中有时间



nmon  -f  -s 1 -c 360 -m /nmon  


一秒采集一次,总共采集6分钟,1x360/3600=6分钟  



先检查一下磁盘的大小

[root@leofs_01 basho_bench]# ansible leofs_storage -m shell -a  "du -sh  /data/leofs "

10.39.1.26 | SUCCESS | rc=0 >>

332K/data/leofs



10.39.1.25 | SUCCESS | rc=0 >>

332K/data/leofs



10.39.1.27 | SUCCESS | rc=0 >>

132K/data/leofs



同时写入9.7GB 16KB大小的文件 ,用时5分钟

用时5分钟

ansible leofs_storage -m shell -a  "du -sh /data/leofs "

10.39.1.26 | SUCCESS | rc=0 >>

9.7G/data/leofs



10.39.1.25 | SUCCESS | rc=0 >>

9.7G/data/leofs



10.39.1.27 | SUCCESS | rc=0 >>

9.7G/data/leofs





把网关的线程池打开设置为64  

# 网关配置线程池

## Large Object Handler - put worker pool size

large_object.put_worker_pool_size = 16



## Large Object Handler - put worker buffer size

large_object.put_worker_buffer_size = 32

## Memory cache capacity in bytes

cache.cache_ram_capacity = 0



## Disk cache capacity in bytes

cache.cache_disc_capacity = 0



## When the length of the object exceeds this value, store the object on disk

cache.cache_disc_threshold_len = 1048576



## Directory for the disk cache data

cache.cache_disc_dir_data = ./cache/data



## Directory for the disk cache journal

cache.cache_disc_dir_journal = ./cache/journal



10万 文件用时一分钟 使用比例如下



4096.. 8192: 15%

8192.. 16384: 25%

16384.. 32768: 23%

32768.. 65536: 22%

65536.. 131072: 15%



{mode, max}.

{duration, 1000}.

{concurrent, 64}.



{driver, basho_bench_driver_leofs}.

{code_paths, ["deps/ibrowse"]}.



{http_raw_ips, ["10.39.1.28"]}.

{http_raw_port, 8080}.

{http_raw_path, "/abc"}.



{retry_on_overload, true}.

{key_generator, {partitioned_sequential_int, 1000000}}.

{value_generator, {fixed_bin, 262144}}.

{operations, [{put,1}]}.

{value_generator_source_size, 1048576}.

{http_raw_request_timeout, 30000}. % 30seconds

{value_size_groups, [{15, 4096, 8192},{25, 8192, 16384}, {23, 16384, 32768}, {22, 32768, 65536}, {15, 65536, 131072}]}.



查看存储空间大小

ansible leofs_storage -m shell -a  "du -sh /data/leofs "

10.39.1.25 | SUCCESS | rc=0 >>

132K/data/leofs



10.39.1.26 | SUCCESS | rc=0 >>

132K/data/leofs



10.39.1.27 | SUCCESS | rc=0 >>

132K/data/leofs



[root@leofs_01 basho_bench]# ansible leofs_storage -m shell -a  "ls  /data/leofs "

10.39.1.26 | SUCCESS | rc=0 >>

log

metadata

object



10.39.1.27 | SUCCESS | rc=0 >>

log

metadata

object



10.39.1.25 | SUCCESS | rc=0 >>

log

metadata

object





ansible leofs_storage -m shell -a  "du -sh /data/leofs "

10.39.1.25 | SUCCESS | rc=0 >>

4.1G/data/leofs



10.39.1.26 | SUCCESS | rc=0 >>

4.1G/data/leofs



10.39.1.27 | SUCCESS | rc=0 >>

4.1G/data/leofs



ansible leofs_storage -m shell -a  "ls   /data/leofs "

10.39.1.26 | SUCCESS | rc=0 >>

log

metadata

object



10.39.1.27 | SUCCESS | rc=0 >>

log

metadata

object



10.39.1.25 | SUCCESS | rc=0 >>

log

metadata

object

state




ansible leofs_storage -m shell -a  "nmon  -f  -s 1 -c 1440 -m /nmon "  

采集24分钟内的数据



100万  5%写    95% 读



{mode, max}.

{duration,   30}.

{concurrent, 64}.



{driver, basho_bench_driver_leofs}.

{code_paths, ["deps/ibrowse"]}.



{http_raw_ips, ["192.168.100.35"]}.

{http_raw_port, 8080}.

{http_raw_path, "/test"}.



{retry_on_overload, true}.

{key_generator, {uniform_int,1000000}}.

{value_generator, {fixed_bin, 262144}}.

{operations, [{put,5}, {get, 95}]}.

{value_generator_source_size, 1048576}.

{http_raw_request_timeout, 30000}. % 30seconds

{value_size_groups, [{15, 4096, 8192},{25, 8192, 16384}, {23, 16384, 32768}, {22, 32768, 65536}, {15, 65536, 131072}]}.



10.39.1.23 安装LeoCenter

git clone https://github.com/leo-project/leo_center.git

yum install ruby-devel -y

cd leo_center/

gem install bundler  

bundle install



修改配置

config.yml



:managers:

  - "localhost:10020" # master

  - "localhost:10021" # slave

:credential:

  :access_key_id: "YOUR_ACCESS_KEY_ID"

  :secret_access_key: "YOUR_SECRET_ACCESS_KEY"



  启动服务

  thin start -a ${HOST} -p ${PORT} > /dev/null 2>&1  &  

 

  创建管理员

  You need to create an administrator user from LeoFS-Manager’s console.

  $ leofs-adm create-user leo_admin password

    access-key-id: ab96d56258e0e9d3621a

    secret-access-key: 5c3d9c188d3e4c4372e414dbd325da86ecaa8068



   $ leofs-adm update-user-role leo_admin 9

     OK







  leofs-adm create-user leo_admin password

     access-key-id: 8d9de6fdfb35f837e9ed

     secret-access-key: 7dcc2631493865c7fb7ec7f96dda627f1cbb21eb

   

   leofs-adm update-user-role leo_admin 9

    OK

    [root@leofs_01 leo_center]# leofs-adm get-users

     user_id   | role_id | access_key_id          | created_at                

     ----------+---------+------------------------+---------------------------

     leo_admin | 9       | 8d9de6fdfb35f837e9ed   | 2017-03-31 11:40:14 +0800

      test      | 1       | 919ca38e3fb34085b94a   | 2017-03-30 15:45:41 +0800

经过测试。

删除用户buckets 是存在的,只有当buckets 删除之后数据才能真正删除

原文链接:https://xiaohost.com/11356.html,转载请注明出处。
0

评论0

请先