-
步驟1
下載jar包及其組態檔 -
步驟2
把下載好的檔案上傳到服務器上,我這里上傳的目錄是/home/ambry

-
步驟3
- 啟動前要修改的檔案串列(在x.x.x.8 服務器上部署為例)
1. HardwareLayout_8.json
2. PartitionLayout_8.json
3. frontend_8.properties
4. server8.properties - 修改組態檔HardwareLayout.json,這個檔案宣告的是硬碟的
{
"clusterName": "OneDiskOneReplica",
"version": 99,
"datacenters": [
{
"dataNodes": [ #dataNodes是可以存放陣列的形式,添加多個元素就可以把資料存盤到多臺服務器,形成ambry集群
{
"disks": [
{
"capacityInBytes": 429496729600,#硬碟空間大小
"hardwareState": "AVAILABLE",#狀態
"mountPath": "/home/ambry/data"#存盤的位置
}
],
"hardwareState": "AVAILABLE",
"hostname": "x.x.x.8",#ip地址
"port": 1100 #埠
}
],
"name": "Datacenter",
"id" : "1"
}
]
}
- 修改PartitionLayout.json檔案,這個是宣告邏輯存盤的配置,決定了ambry最終能存放多少的大小,
{"id": 0,
"partitionClass": "max-replicas-all-datacenters",
"partitionState": "READ_WRITE", #讀寫模式
"replicaCapacityInBytes": 429496729600, #初始化的大小、第一次啟動就分配好空間了,如果要修改大小,需要洗掉原來的檔案夾,然后重新啟動
"replicas": [ #備份模式,只填本機的就不會備份,這里是個陣列,可以配置多個,多個就會產生備份資料
{
"hostname": "x.x.x.8", #物理機的地址
"mountPath": "/home/ambry/data", #資料存盤的路徑
"port": 1100 #后端服務所使用的埠
}
]}
- 修改server.properties
#填寫ip,不用寫localhost
host.name=x.x.x.8
port=1100
#cluster map
clustermap.cluster.name=Ambry_Dev
clustermap.datacenter.name=Datacenter
clustermap.host.name=x.x.x.8
- 修改前端的配置frontend.json
# rest server 、不同版本ambry的這個填寫不一樣
rest.server.blob.storage.service.factory=com.github.ambry.frontend.AmbryBlobStorageServiceFactory
# rest.server.account.service.factory=com.github.ambry.account.HelixAccountServiceFactory
# router
router.hostname=x.x.x.8
router.datacenter.name=Datacenter
router.ttl.update.success.target=1
router.put.success.target=1
router.delete.success.target=1
# router.max.put.chunk.size.bytes=1048576
# cluster map
clustermap.cluster.name=Ambry_Dev
clustermap.datacenter.name=Datacenter
clustermap.host.name=x.x.x.8
# helix property store
# helix.property.store.zk.client.connect.string=localhost:2182
# helix.property.store.root.path=/ambry/Ambry_Dev/helixPropertyStore
#kms
kms.default.container.key=B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF
- 步驟4
- ambry后端啟動 ,這里是啟動x.x.x.8 的ambry
nohup java -Dlog4j.configuration=file:./config/log4j.properties -jar ambry.jar --serverPropsFilePath ./config/server1.properties --hardwareLayoutFilePath ./config/HardwareLayout.json --partitionLayoutFilePath ./config/PartitionLayout.json > logs/server.log &
- ambry前端啟動 ,這里是啟動x.x.x.8 的ambry,前端只需要在一個服務器作為入口,前端連接后端的示意圖如下
nohup java -Dlog4j.configuration=file:./config/log4j.properties -cp "*" com.github.ambry.frontend.AmbryFrontendMain --serverPropsFilePath ./config/frontend.properties --hardwareLayoutFilePath ./config/HardwareLayout.json --partitionLayoutFilePath ./config/PartitionLayout.json > logs/frontend.log &

- 步驟5,檢驗是否啟動成功
使用 curl 127.0.0.1:1174/healthCheck 回傳Good 就是部署成功了

后端啟動日志的圖中在我們制定的目錄下有分配了存盤空間,可以進入到目錄里面 看,也可以使用命令的方式 du -sh 查詢分配的大小

- 重復以上步驟 在機器x.x.x.9 和 x.x.x.13 啟動后端的服務器即可完成集群的搭建,在x.x.x.9用的埠是1101,x.x.x.13 用的埠是1102
部署3機器的集群完整的hardwareLayout和patitionLayout檔案
- PatitionLayout.json
{
"clusterName": "OneDiskOneReplica",
"version": 21,
"partitions": [
{
"id": 0,
"partitionClass": "max-replicas-all-datacenters",
"partitionState": "READ_WRITE",
"replicaCapacityInBytes": 429496729600,
"replicas": [
{
"hostname": "x.x.x.8",
"mountPath": "/home/ambry/data4",
"port": 1100
}
]
},
{
"id": 1,
"partitionClass": "max-replicas-all-datacenters",
"partitionState": "READ_WRITE",
"replicaCapacityInBytes": 429496729600,
"replicas": [
{
"hostname": "x.x.x.9",
"mountPath": "/home/ambry/data4",
"port": 1101
}
]
},
{
"id": 2,
"partitionClass": "max-replicas-all-datacenters",
"partitionState": "READ_WRITE",
"replicaCapacityInBytes": 429496729600,
"replicas": [
{
"hostname": "x.x.x.13",
"mountPath": "/home/ambry/data4",
"port": 1102
}
]
}
]
}
- HardWareLayout.json
{
"clusterName": "hardwareLayout-mutilDisk",
"version": 1,
"datacenters": [
{
"dataNodes": [
{
"disks": [
{
"capacityInBytes": 21474836480,
"hardwareState": "AVAILABLE",
"mountPath": "/home/ambry/data4"
}
],
"hardwareState": "AVAILABLE",
"hostname": "x.x.x.8",
"port": 1100
},
{
"disks": [
{
"capacityInBytes": 21474836480,
"hardwareState": "AVAILABLE",
"mountPath": "/home/ambry/data4"
}
],
"hardwareState": "AVAILABLE",
"hostname": "x.x.x.9",
"port": 1101
}
,
{
"disks": [
{
"capacityInBytes": 21474836480,
"hardwareState": "AVAILABLE",
"mountPath": "/home/ambry/data4"
}
],
"hardwareState": "AVAILABLE",
"hostname": "x.x.x.13",
"port": 1102
}
],
"name": "Datacenter",
"id": "1"
}
]
}
關于PartitionLayout和hardwareLayout布局的圖片形式,可以根據自己的需求配置不一樣的布局方式,


下載ambry相關檔案
鏈接:https://pan.baidu.com/s/1dJ7wC_N-p7WLsQMQsze8rg
提取碼:ylcg
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/169411.html
標籤:其他
上一篇:docker容器學習資料
下一篇:mysql主從配置
