mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2025-12-19 18:32:23 +08:00
优化集群创建脚本
This commit is contained in:
@@ -10,12 +10,14 @@
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 15px;
|
||||
font-size: 18px;
|
||||
line-height: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
#log {
|
||||
margin: 10px;
|
||||
display: none;
|
||||
@@ -28,6 +30,7 @@
|
||||
|
||||
#log p {
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
@@ -41,9 +44,14 @@
|
||||
<div id="captcha"></div>
|
||||
<div id="log"></div>
|
||||
<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">
|
||||
<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>
|
||||
<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg"
|
||||
x="0px" y="0px" width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;"
|
||||
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>
|
||||
</svg>
|
||||
</div>
|
||||
@@ -135,12 +143,12 @@
|
||||
log('Error Ocurred.');
|
||||
try {
|
||||
if (typeof JSInterface !== 'undefined') {
|
||||
if (typeof JSInterface.gtError === 'function') {
|
||||
JSInterface.gtError();
|
||||
}
|
||||
if (typeof JSInterface.gt3Error === 'function') {
|
||||
JSInterface.gt3Error(JSON.stringify(err))
|
||||
}
|
||||
if (typeof JSInterface.gtError === 'function') {
|
||||
JSInterface.gtError();
|
||||
}
|
||||
if (typeof JSInterface.gt3Error === 'function') {
|
||||
JSInterface.gt3Error(JSON.stringify(err))
|
||||
}
|
||||
}
|
||||
loadingEle.style.display = 'none'
|
||||
} catch (e) {
|
||||
@@ -149,14 +157,14 @@
|
||||
try {
|
||||
if (window.webkit
|
||||
&& window.webkit.messageHandlers) {
|
||||
err = err || {};
|
||||
err.error = '1';
|
||||
var message = JSON.stringify(err);
|
||||
if (window.webkit.messageHandlers.gtError) {
|
||||
window.webkit.messageHandlers.gtError.postMessage(message);
|
||||
}
|
||||
err = err || {};
|
||||
err.error = '1';
|
||||
var message = JSON.stringify(err);
|
||||
if (window.webkit.messageHandlers.gtError) {
|
||||
window.webkit.messageHandlers.gtError.postMessage(message);
|
||||
}
|
||||
if (window.webkit.messageHandlers.gt3Error) {
|
||||
window.webkit.messageHandlers.gt3Error.postMessage(message);
|
||||
window.webkit.messageHandlers.gt3Error.postMessage(message);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -261,9 +269,9 @@
|
||||
}
|
||||
});
|
||||
captchaObj.onError(errorHandler);
|
||||
if(typeof captchaObj.onChangeCaptcha === 'function'){
|
||||
if (typeof captchaObj.onChangeCaptcha === 'function') {
|
||||
captchaObj.onChangeCaptcha(function (type) {
|
||||
var notification = { aspect_radio: args[('aspect_radio_'+type)] }
|
||||
var notification = {aspect_radio: args[('aspect_radio_' + type)]}
|
||||
try {
|
||||
if (typeof JSInterface !== 'undefined') {
|
||||
JSInterface.gtNotify(JSON.stringify(notification));
|
||||
@@ -309,8 +317,8 @@
|
||||
s.onload = s.onreadystatechange = function () {
|
||||
if (!loaded &&
|
||||
(!s.readyState
|
||||
|| s.readyState === "loaded"
|
||||
|| s.readyState === 'complete')) {
|
||||
|| s.readyState === "loaded"
|
||||
|| s.readyState === 'complete')) {
|
||||
if (test()) {
|
||||
loaded = true;
|
||||
callback(null);
|
||||
@@ -328,7 +336,7 @@
|
||||
head.appendChild(s);
|
||||
};
|
||||
|
||||
function init(js){
|
||||
function init(js) {
|
||||
loadJS(static_servers, js, function () {
|
||||
return window.Geetest;
|
||||
}, function (err) {
|
||||
@@ -340,6 +348,7 @@
|
||||
handler(config);
|
||||
});
|
||||
}
|
||||
|
||||
init(js);
|
||||
</script>
|
||||
</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:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 128M
|
||||
memory: 512M
|
||||
dispatch_services:
|
||||
restart: always
|
||||
image: flswld/dispatch:1.0.0
|
||||
@@ -42,11 +42,11 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 128M
|
||||
gate_services:
|
||||
memory: 512M
|
||||
gate_320_services:
|
||||
restart: always
|
||||
image: flswld/gate:1.0.0
|
||||
container_name: gate
|
||||
container_name: gate_320
|
||||
ports:
|
||||
- "22222:22222/udp"
|
||||
- "33333:33333/tcp"
|
||||
@@ -65,8 +65,8 @@ services:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
memory: 1024M
|
||||
cpus: '8.00'
|
||||
memory: 8192M
|
||||
anticheat_services:
|
||||
restart: always
|
||||
image: flswld/anticheat:1.0.0
|
||||
@@ -83,12 +83,12 @@ services:
|
||||
- ./anticheat/bin/application.toml:/anticheat/application.toml
|
||||
- ../gdconf/game_data_config:/anticheat/game_data_config
|
||||
depends_on:
|
||||
- gate_services
|
||||
- gate_320_services
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 128M
|
||||
memory: 512M
|
||||
pathfinding_services:
|
||||
restart: always
|
||||
image: flswld/pathfinding:1.0.0
|
||||
@@ -108,12 +108,12 @@ services:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
memory: 1024M
|
||||
gs_services:
|
||||
cpus: '1.00'
|
||||
memory: 512M
|
||||
gs_1_services:
|
||||
restart: always
|
||||
image: flswld/gs:1.0.0
|
||||
container_name: gs
|
||||
container_name: gs_1
|
||||
ports:
|
||||
- "4567:4567/tcp"
|
||||
environment:
|
||||
@@ -130,8 +130,52 @@ services:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
memory: 4096M
|
||||
cpus: '8.00'
|
||||
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:
|
||||
restart: always
|
||||
image: flswld/gm:1.0.0
|
||||
@@ -148,9 +192,9 @@ services:
|
||||
- /usr/share/zoneinfo:/usr/share/zoneinfo
|
||||
- ./gm/bin/application.toml:/gm/application.toml
|
||||
depends_on:
|
||||
- gs_services
|
||||
- gs_3_services
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 128M
|
||||
memory: 512M
|
||||
|
||||
@@ -1,37 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
IP=$1
|
||||
echo "create mongo cluster, host ip: ${IP}"
|
||||
|
||||
echo "init mongo cluster shard"
|
||||
# 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"}]})
|
||||
EOF
|
||||
|
||||
# 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"}]})
|
||||
EOF
|
||||
|
||||
# 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"}]})
|
||||
EOF
|
||||
|
||||
echo "init mongo cluster config"
|
||||
# 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"}]})
|
||||
EOF
|
||||
|
||||
sleep 30
|
||||
|
||||
echo "init mongo cluster mongos"
|
||||
# mongos1
|
||||
mongo --host 192.168.199.233 --port 27117 <<EOF
|
||||
mongo --host "${IP}" --port 27117 <<EOF
|
||||
sh.addShard("shard1/mongo_shard1:27018")
|
||||
sh.addShard("shard2/mongo_shard2:27018")
|
||||
sh.addShard("shard3/mongo_shard3:27018")
|
||||
EOF
|
||||
|
||||
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.shardCollection("dispatch_hk4e.account", {"AccountID": "hashed"})
|
||||
sh.enableBalancing("dispatch_hk4e.account")
|
||||
|
||||
@@ -18,7 +18,7 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
memory: 512M
|
||||
memory: 2048M
|
||||
|
||||
mongo_shard2:
|
||||
restart: always
|
||||
@@ -38,7 +38,7 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
memory: 512M
|
||||
memory: 2048M
|
||||
|
||||
mongo_shard3:
|
||||
restart: always
|
||||
@@ -58,7 +58,7 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
memory: 512M
|
||||
memory: 2048M
|
||||
|
||||
mongo_config1:
|
||||
restart: always
|
||||
@@ -81,7 +81,7 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 256M
|
||||
memory: 512M
|
||||
|
||||
mongo_config2:
|
||||
restart: always
|
||||
@@ -104,7 +104,7 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 256M
|
||||
memory: 512M
|
||||
|
||||
mongo_config3:
|
||||
restart: always
|
||||
@@ -127,7 +127,7 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '1.00'
|
||||
memory: 256M
|
||||
memory: 512M
|
||||
|
||||
mongo_mongos1:
|
||||
restart: always
|
||||
@@ -149,7 +149,7 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.00'
|
||||
memory: 128M
|
||||
memory: 1024M
|
||||
|
||||
mongo_mongos2:
|
||||
restart: always
|
||||
@@ -171,7 +171,7 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.00'
|
||||
memory: 128M
|
||||
memory: 1024M
|
||||
|
||||
mongo_mongos3:
|
||||
restart: always
|
||||
@@ -193,4 +193,4 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.00'
|
||||
memory: 128M
|
||||
memory: 1024M
|
||||
|
||||
@@ -15,5 +15,5 @@ services:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.00'
|
||||
cpus: '1.00'
|
||||
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
|
||||
|
||||
IP=$1
|
||||
echo "create redis cluster, host ip: ${IP}"
|
||||
|
||||
redis-cli -a 123456 --cluster create \
|
||||
192.168.199.233:6371 \
|
||||
192.168.199.233:6372 \
|
||||
192.168.199.233:6373 \
|
||||
192.168.199.233:6374 \
|
||||
192.168.199.233:6375 \
|
||||
192.168.199.233:6376 \
|
||||
"${IP}":6371 \
|
||||
"${IP}":6372 \
|
||||
"${IP}":6373 \
|
||||
"${IP}":6374 \
|
||||
"${IP}":6375 \
|
||||
"${IP}":6376 \
|
||||
--cluster-replicas 1
|
||||
|
||||
Reference in New Issue
Block a user