Update duokai.sh
This commit is contained in:
parent
e9358b8920
commit
011776d976
32
duokai.sh
32
duokai.sh
@ -19,6 +19,9 @@ read -p "输入你的身份码: " id
|
||||
# 让用户输入想要创建的容器数量
|
||||
read -p "请输入你想要创建的节点数量,单IP限制最多5个节点: " container_count
|
||||
|
||||
# 让用户输入起始 RPC 端口号
|
||||
read -p "请输入你想要设置的起始 RPC 端口号: " start_rpc_port
|
||||
|
||||
# 让用户输入想要分配的空间大小
|
||||
read -p "请输入你想要分配每个节点的存储空间大小(GB),单个上限64G, 网页生效较慢,等待20分钟后,网页查询即可: " storage_gb
|
||||
|
||||
@ -43,8 +46,10 @@ fi
|
||||
docker pull nezha123/titan-edge:1.4
|
||||
|
||||
# 创建用户指定数量的容器
|
||||
for i in $(seq 1 $container_count)
|
||||
for ((i=1; i<=container_count; i++))
|
||||
do
|
||||
current_rpc_port=$((start_rpc_port + i - 1))
|
||||
|
||||
# 判断用户是否输入了自定义存储路径
|
||||
if [ -z "$custom_storage_path" ]; then
|
||||
# 用户未输入,使用默认路径
|
||||
@ -64,17 +69,24 @@ do
|
||||
|
||||
sleep 30
|
||||
|
||||
# 修改宿主机上的config.toml文件以设置StorageGB值
|
||||
docker exec $container_id bash -c "\
|
||||
# 修改宿主机上的config.toml文件以设置StorageGB值和端口
|
||||
docker exec $container_id bash -c "\
|
||||
sed -i 's/^[[:space:]]*#StorageGB = .*/StorageGB = $storage_gb/' /root/.titanedge/config.toml && \
|
||||
echo '容器 titan'$i' 的存储空间已设置为 $storage_gb GB'"
|
||||
sed -i 's/^[[:space:]]*#ListenAddress = \"0.0.0.0:1234\"/#ListenAddress = \"0.0.0.0:$current_rpc_port\"/' /root/.titanedge/config.toml && \
|
||||
echo '容器 titan'$i' 的存储空间设置为 $storage_gb GB,RPC 端口设置为 $current_rpc_port'"
|
||||
done
|
||||
|
||||
# 进入容器并执行绑定和其他命令
|
||||
# 重启所有docker容器 让设置的磁盘容量生效
|
||||
docker restart $(docker ps -a -q)
|
||||
|
||||
# 执行绑定命令
|
||||
for ((i=1; i<=container_count; i++))
|
||||
do
|
||||
container_id=$(docker ps -aqf "name=titan$i")
|
||||
# 进入容器并执行绑定命令
|
||||
docker exec $container_id bash -c "\
|
||||
titan-edge bind --hash=$id https://api-test1.container1.titannet.io/api/v2/device/binding"
|
||||
|
||||
|
||||
echo "节点 titan$i 已绑定."
|
||||
done
|
||||
# 重启所有docker镜像 让设置的磁盘容量生效
|
||||
docker restart $(docker ps -a -q)
|
||||
echo "==============================所有节点均已设置并启动===================================."
|
||||
|
||||
echo "==============================所有节点均已设置并启动==================================="
|
||||
|
Loading…
Reference in New Issue
Block a user