mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 14:42:26 +08:00
优化集群创建脚本
This commit is contained in:
@@ -10,12 +10,14 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin: 15px;
|
margin: 15px;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#log {
|
#log {
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
display: none;
|
display: none;
|
||||||
@@ -28,6 +30,7 @@
|
|||||||
|
|
||||||
#log p {
|
#log p {
|
||||||
}
|
}
|
||||||
|
|
||||||
#loading {
|
#loading {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@@ -41,9 +44,14 @@
|
|||||||
<div id="captcha"></div>
|
<div id="captcha"></div>
|
||||||
<div id="log"></div>
|
<div id="log"></div>
|
||||||
<div id="loading">
|
<div id="loading">
|
||||||
<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
|
<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg"
|
||||||
<path fill="#c7c5c5" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z" transform="rotate(340 25 25)">
|
x="0px" y="0px" width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;"
|
||||||
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform>
|
xml:space="preserve">
|
||||||
|
<path fill="#c7c5c5"
|
||||||
|
d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"
|
||||||
|
transform="rotate(340 25 25)">
|
||||||
|
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25"
|
||||||
|
dur="0.6s" repeatCount="indefinite"></animateTransform>
|
||||||
</path>
|
</path>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
@@ -340,6 +348,7 @@
|
|||||||
handler(config);
|
handler(config);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
init(js);
|
init(js);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
{"version":16}
|
{
|
||||||
|
"version": 16
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1 +1,3 @@
|
|||||||
{"version":69}
|
{
|
||||||
|
"version": 69
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1 +1,3 @@
|
|||||||
{"version":66}
|
{
|
||||||
|
"version": 66
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -18,7 +18,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '1.00'
|
cpus: '1.00'
|
||||||
memory: 128M
|
memory: 512M
|
||||||
dispatch_services:
|
dispatch_services:
|
||||||
restart: always
|
restart: always
|
||||||
image: flswld/dispatch:1.0.0
|
image: flswld/dispatch:1.0.0
|
||||||
@@ -42,11 +42,11 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '1.00'
|
cpus: '1.00'
|
||||||
memory: 128M
|
memory: 512M
|
||||||
gate_services:
|
gate_320_services:
|
||||||
restart: always
|
restart: always
|
||||||
image: flswld/gate:1.0.0
|
image: flswld/gate:1.0.0
|
||||||
container_name: gate
|
container_name: gate_320
|
||||||
ports:
|
ports:
|
||||||
- "22222:22222/udp"
|
- "22222:22222/udp"
|
||||||
- "33333:33333/tcp"
|
- "33333:33333/tcp"
|
||||||
@@ -65,8 +65,8 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '4.00'
|
cpus: '8.00'
|
||||||
memory: 1024M
|
memory: 8192M
|
||||||
anticheat_services:
|
anticheat_services:
|
||||||
restart: always
|
restart: always
|
||||||
image: flswld/anticheat:1.0.0
|
image: flswld/anticheat:1.0.0
|
||||||
@@ -83,12 +83,12 @@ services:
|
|||||||
- ./anticheat/bin/application.toml:/anticheat/application.toml
|
- ./anticheat/bin/application.toml:/anticheat/application.toml
|
||||||
- ../gdconf/game_data_config:/anticheat/game_data_config
|
- ../gdconf/game_data_config:/anticheat/game_data_config
|
||||||
depends_on:
|
depends_on:
|
||||||
- gate_services
|
- gate_320_services
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '1.00'
|
cpus: '1.00'
|
||||||
memory: 128M
|
memory: 512M
|
||||||
pathfinding_services:
|
pathfinding_services:
|
||||||
restart: always
|
restart: always
|
||||||
image: flswld/pathfinding:1.0.0
|
image: flswld/pathfinding:1.0.0
|
||||||
@@ -108,12 +108,12 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '4.00'
|
cpus: '1.00'
|
||||||
memory: 1024M
|
memory: 512M
|
||||||
gs_services:
|
gs_1_services:
|
||||||
restart: always
|
restart: always
|
||||||
image: flswld/gs:1.0.0
|
image: flswld/gs:1.0.0
|
||||||
container_name: gs
|
container_name: gs_1
|
||||||
ports:
|
ports:
|
||||||
- "4567:4567/tcp"
|
- "4567:4567/tcp"
|
||||||
environment:
|
environment:
|
||||||
@@ -130,8 +130,52 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '4.00'
|
cpus: '8.00'
|
||||||
memory: 4096M
|
memory: 8192M
|
||||||
|
gs_2_services:
|
||||||
|
restart: always
|
||||||
|
image: flswld/gs:1.0.0
|
||||||
|
container_name: gs_2
|
||||||
|
ports:
|
||||||
|
- "4568:4567/tcp"
|
||||||
|
environment:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime
|
||||||
|
- /etc/timezone:/etc/timezone
|
||||||
|
- /usr/share/zoneinfo:/usr/share/zoneinfo
|
||||||
|
- ./gs/bin/application.toml:/gs/application.toml
|
||||||
|
- ../gdconf/game_data_config:/gs/game_data_config
|
||||||
|
depends_on:
|
||||||
|
- gs_1_services
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '8.00'
|
||||||
|
memory: 8192M
|
||||||
|
gs_3_services:
|
||||||
|
restart: always
|
||||||
|
image: flswld/gs:1.0.0
|
||||||
|
container_name: gs_3
|
||||||
|
ports:
|
||||||
|
- "4569:4567/tcp"
|
||||||
|
environment:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime
|
||||||
|
- /etc/timezone:/etc/timezone
|
||||||
|
- /usr/share/zoneinfo:/usr/share/zoneinfo
|
||||||
|
- ./gs/bin/application.toml:/gs/application.toml
|
||||||
|
- ../gdconf/game_data_config:/gs/game_data_config
|
||||||
|
depends_on:
|
||||||
|
- gs_2_services
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '8.00'
|
||||||
|
memory: 8192M
|
||||||
gm_services:
|
gm_services:
|
||||||
restart: always
|
restart: always
|
||||||
image: flswld/gm:1.0.0
|
image: flswld/gm:1.0.0
|
||||||
@@ -148,9 +192,9 @@ services:
|
|||||||
- /usr/share/zoneinfo:/usr/share/zoneinfo
|
- /usr/share/zoneinfo:/usr/share/zoneinfo
|
||||||
- ./gm/bin/application.toml:/gm/application.toml
|
- ./gm/bin/application.toml:/gm/application.toml
|
||||||
depends_on:
|
depends_on:
|
||||||
- gs_services
|
- gs_3_services
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '1.00'
|
cpus: '1.00'
|
||||||
memory: 128M
|
memory: 512M
|
||||||
|
|||||||
@@ -1,37 +1,40 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
IP=$1
|
||||||
|
echo "create mongo cluster, host ip: ${IP}"
|
||||||
|
|
||||||
|
echo "init mongo cluster shard"
|
||||||
# shard1
|
# shard1
|
||||||
mongo --host 192.168.199.233 --port 27118 <<EOF
|
mongo --host "${IP}" --port 27118 <<EOF
|
||||||
rs.initiate({_id: "shard1", members: [{_id: 0, host: "mongo_shard1:27018"}]})
|
rs.initiate({_id: "shard1", members: [{_id: 0, host: "mongo_shard1:27018"}]})
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# shard2
|
# shard2
|
||||||
mongo --host 192.168.199.233 --port 27218 <<EOF
|
mongo --host "${IP}" --port 27218 <<EOF
|
||||||
rs.initiate({_id: "shard2", members: [{_id: 0, host: "mongo_shard2:27018"}]})
|
rs.initiate({_id: "shard2", members: [{_id: 0, host: "mongo_shard2:27018"}]})
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# shard3
|
# shard3
|
||||||
mongo --host 192.168.199.233 --port 27318 <<EOF
|
mongo --host "${IP}" --port 27318 <<EOF
|
||||||
rs.initiate({_id: "shard3", members: [{_id: 0, host: "mongo_shard3:27018"}]})
|
rs.initiate({_id: "shard3", members: [{_id: 0, host: "mongo_shard3:27018"}]})
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
echo "init mongo cluster config"
|
||||||
# config1
|
# config1
|
||||||
mongo --host 192.168.199.233 --port 27119 <<EOF
|
mongo --host "${IP}" --port 27119 <<EOF
|
||||||
rs.initiate({_id: "config", configsvr: true, members: [{_id: 0, host: "mongo_config1:27019"}, {_id: 1, host: "mongo_config2:27019"}, {_id: 2, host: "mongo_config3:27019"}]})
|
rs.initiate({_id: "config", configsvr: true, members: [{_id: 0, host: "mongo_config1:27019"}, {_id: 1, host: "mongo_config2:27019"}, {_id: 2, host: "mongo_config3:27019"}]})
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
|
echo "init mongo cluster mongos"
|
||||||
# mongos1
|
# mongos1
|
||||||
mongo --host 192.168.199.233 --port 27117 <<EOF
|
mongo --host "${IP}" --port 27117 <<EOF
|
||||||
sh.addShard("shard1/mongo_shard1:27018")
|
sh.addShard("shard1/mongo_shard1:27018")
|
||||||
sh.addShard("shard2/mongo_shard2:27018")
|
sh.addShard("shard2/mongo_shard2:27018")
|
||||||
sh.addShard("shard3/mongo_shard3:27018")
|
sh.addShard("shard3/mongo_shard3:27018")
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
mongo --host 192.168.199.233 --port 27117 <<EOF
|
echo "init hk4e database table"
|
||||||
|
mongo --host "${IP}" --port 27117 <<EOF
|
||||||
sh.enableSharding("dispatch_hk4e")
|
sh.enableSharding("dispatch_hk4e")
|
||||||
sh.shardCollection("dispatch_hk4e.account", {"AccountID": "hashed"})
|
sh.shardCollection("dispatch_hk4e.account", {"AccountID": "hashed"})
|
||||||
sh.enableBalancing("dispatch_hk4e.account")
|
sh.enableBalancing("dispatch_hk4e.account")
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '4.00'
|
cpus: '4.00'
|
||||||
memory: 512M
|
memory: 2048M
|
||||||
|
|
||||||
mongo_shard2:
|
mongo_shard2:
|
||||||
restart: always
|
restart: always
|
||||||
@@ -38,7 +38,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '4.00'
|
cpus: '4.00'
|
||||||
memory: 512M
|
memory: 2048M
|
||||||
|
|
||||||
mongo_shard3:
|
mongo_shard3:
|
||||||
restart: always
|
restart: always
|
||||||
@@ -58,7 +58,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '4.00'
|
cpus: '4.00'
|
||||||
memory: 512M
|
memory: 2048M
|
||||||
|
|
||||||
mongo_config1:
|
mongo_config1:
|
||||||
restart: always
|
restart: always
|
||||||
@@ -81,7 +81,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '1.00'
|
cpus: '1.00'
|
||||||
memory: 256M
|
memory: 512M
|
||||||
|
|
||||||
mongo_config2:
|
mongo_config2:
|
||||||
restart: always
|
restart: always
|
||||||
@@ -104,7 +104,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '1.00'
|
cpus: '1.00'
|
||||||
memory: 256M
|
memory: 512M
|
||||||
|
|
||||||
mongo_config3:
|
mongo_config3:
|
||||||
restart: always
|
restart: always
|
||||||
@@ -127,7 +127,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '1.00'
|
cpus: '1.00'
|
||||||
memory: 256M
|
memory: 512M
|
||||||
|
|
||||||
mongo_mongos1:
|
mongo_mongos1:
|
||||||
restart: always
|
restart: always
|
||||||
@@ -149,7 +149,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '2.00'
|
cpus: '2.00'
|
||||||
memory: 128M
|
memory: 1024M
|
||||||
|
|
||||||
mongo_mongos2:
|
mongo_mongos2:
|
||||||
restart: always
|
restart: always
|
||||||
@@ -171,7 +171,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '2.00'
|
cpus: '2.00'
|
||||||
memory: 128M
|
memory: 1024M
|
||||||
|
|
||||||
mongo_mongos3:
|
mongo_mongos3:
|
||||||
restart: always
|
restart: always
|
||||||
@@ -193,4 +193,4 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '2.00'
|
cpus: '2.00'
|
||||||
memory: 128M
|
memory: 1024M
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '4.00'
|
cpus: '1.00'
|
||||||
memory: 512M
|
memory: 512M
|
||||||
|
|||||||
11
docker/3rd/redis/redis_cluster/conf/update_config.sh
Executable file
11
docker/3rd/redis/redis_cluster/conf/update_config.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IP=$1
|
||||||
|
echo "update redis config, host ip: ${IP}"
|
||||||
|
|
||||||
|
sed -i s/192.168.199.233/"${IP}"/ ./redis1/redis.conf
|
||||||
|
sed -i s/192.168.199.233/"${IP}"/ ./redis2/redis.conf
|
||||||
|
sed -i s/192.168.199.233/"${IP}"/ ./redis3/redis.conf
|
||||||
|
sed -i s/192.168.199.233/"${IP}"/ ./redis4/redis.conf
|
||||||
|
sed -i s/192.168.199.233/"${IP}"/ ./redis5/redis.conf
|
||||||
|
sed -i s/192.168.199.233/"${IP}"/ ./redis6/redis.conf
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
IP=$1
|
||||||
|
echo "create redis cluster, host ip: ${IP}"
|
||||||
|
|
||||||
redis-cli -a 123456 --cluster create \
|
redis-cli -a 123456 --cluster create \
|
||||||
192.168.199.233:6371 \
|
"${IP}":6371 \
|
||||||
192.168.199.233:6372 \
|
"${IP}":6372 \
|
||||||
192.168.199.233:6373 \
|
"${IP}":6373 \
|
||||||
192.168.199.233:6374 \
|
"${IP}":6374 \
|
||||||
192.168.199.233:6375 \
|
"${IP}":6375 \
|
||||||
192.168.199.233:6376 \
|
"${IP}":6376 \
|
||||||
--cluster-replicas 1
|
--cluster-replicas 1
|
||||||
|
|||||||
Reference in New Issue
Block a user