系统:分布式部署

This commit is contained in:
luying
2021-08-11 12:01:00 +08:00
parent c91131b263
commit 8677c570e0
3 changed files with 25 additions and 24 deletions
+2 -1
View File
@@ -23,4 +23,5 @@
6.扩容脚本./pm2StarterDistribute.sh 6.扩容脚本./pm2StarterDistribute.sh
7.手输命令示例如下: 7.手输命令示例如下:
`pm2 start ./dist/app.js --name="activity-server-2" -x -- env=dev id=activity-server-2 host=172.26.145.171 port=9061 serverType=activity` `pm2 start ./dist/app.js --name="activity-server-2" -x -- env=dev id=activity-server-2 host=172.26.145.171 port=9061 serverType=activity`
`pm2 start ./dist/app.js --name="connector-server-4" -x -- env=dev id=connector-server-4 host=172.26.145.171 port=9062 clientHost=121.89.211.172 clientPort=3050 serverType=connector frontend=true` `pm2 start ./dist/app.js --name="connector-server-4" -x -- env=alpha id=connector-server-4 host=172.26.145.171 port=9062 clientHost=121.89.211.172 clientPort=3050 serverType=connector frontend=true`
8.主机部分的server.ts内的server如果需要做rpc remotehost需要从127.0.0.1改为私网地址
+2 -2
View File
@@ -11,7 +11,7 @@ module.exports = {
}, },
'alpha': { 'alpha': {
'id': 'master-server-1', 'id': 'master-server-1',
'host': '127.0.0.1', 'host': '172.26.145.159',
'port': 3005 'port': 3005
}, },
'dev': { 'dev': {
@@ -31,7 +31,7 @@ module.exports = {
}, },
'distribute': { 'distribute': {
'id': 'master-server-1', 'id': 'master-server-1',
'host': '172.26.145.161', 'host': '172.26.145.159',
'port': 3005 'port': 3005
} }
}; };
+21 -21
View File
@@ -99,53 +99,53 @@ module.exports = {
}, },
'alpha': { 'alpha': {
'connector': [ 'connector': [
{ 'id': 'connector-server-1', 'port': 4050, 'clientHost': 'zyz_web.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3050, 'frontend': true }, { 'id': 'connector-server-1', 'port': 4050, 'clientHost': 'zyz_web.trgame.cn', 'host': '172.26.145.159', 'clientPort': 3050, 'frontend': true },
{ 'id': 'connector-server-2', 'port': 4051, 'clientHost': 'zyz_web.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3051, 'frontend': true }, { 'id': 'connector-server-2', 'port': 4051, 'clientHost': 'zyz_web.trgame.cn', 'host': '172.26.145.159', 'clientPort': 3051, 'frontend': true },
{ 'id': 'connector-server-3', 'port': 4052, 'clientHost': 'zyz_web.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3052, 'frontend': true } { 'id': 'connector-server-3', 'port': 4052, 'clientHost': 'zyz_web.trgame.cn', 'host': '172.26.145.159', 'clientPort': 3052, 'frontend': true }
], ],
'chat': [ 'chat': [
{ 'id': 'chat-server-1', 'host': '127.0.0.1', 'port': 6050 }, { 'id': 'chat-server-1', 'host': '172.26.145.159', 'port': 6050 },
{ 'id': 'chat-server-2', 'host': '127.0.0.1', 'port': 6051 }, { 'id': 'chat-server-2', 'host': '172.26.145.159', 'port': 6051 },
{ 'id': 'chat-server-3', 'host': '127.0.0.1', 'port': 6052 } { 'id': 'chat-server-3', 'host': '172.26.145.159', 'port': 6052 }
], ],
'role': [ 'role': [
{ 'id': 'role-server-1', 'host': '127.0.0.1', 'port': 6053 } { 'id': 'role-server-1', 'host': '172.26.145.159', 'port': 6053 }
], ],
'battle': [ 'battle': [
{ 'id': 'battle-server-1', 'host': '127.0.0.1', 'port': 6054 } { 'id': 'battle-server-1', 'host': '172.26.145.159', 'port': 6054 }
], ],
'gate': [ 'gate': [
{ 'id': 'gate-server-1', 'host': '127.0.0.1', 'clientHost': 'zyz_web.trgame.cn', 'clientPort': 3014, 'frontend': true }, { 'id': 'gate-server-1', 'host': '172.26.145.159', 'clientHost': 'zyz_web.trgame.cn', 'clientPort': 3014, 'frontend': true },
{ {
'id': 'gate-server-2', 'id': 'gate-server-2',
'host': '127.0.0.1', 'host': '172.26.145.159',
'clientHost': 'zyz_web.trgame.cn', 'clientHost': 'zyz_web.trgame.cn',
'clientPort': 3015, 'clientPort': 3015,
'frontend': true 'frontend': true
} }
], ],
'gm': [ 'gm': [
{ 'id': 'gm-server-1', 'host': '127.0.0.1', 'port': 6055 } { 'id': 'gm-server-1', 'host': '172.26.145.159', 'port': 6055 }
], ],
'systimer': [ 'systimer': [
{ 'id': 'systimer-server-1', 'host': '127.0.0.1', 'port': 6056 } { 'id': 'systimer-server-1', 'host': '172.26.145.159', 'port': 6056 }
], ],
'guild': [ 'guild': [
{ 'id': 'guild-server-1', 'host': '127.0.0.1', 'port': 6057, "args": " --inspect=9239" }, { 'id': 'guild-server-1', 'host': '172.26.145.159', 'port': 6057, "args": " --inspect=9239" },
{ 'id': 'guild-server-2', 'host': '127.0.0.1', 'port': 6058, "args": " --inspect=9240" } { 'id': 'guild-server-2', 'host': '172.26.145.159', 'port': 6058, "args": " --inspect=9240" }
], ],
'activity': [ 'activity': [
{ 'id': 'activity-server-1', 'host': '127.0.0.1', 'port': 6059, "args": " --inspect=9241" }, { 'id': 'activity-server-1', 'host': '172.26.145.159', 'port': 6059, "args": " --inspect=9241" },
], ],
'order': [ 'order': [
{ 'id': 'order-server-1', 'host': '127.0.0.1', 'port': 6060, "args": " --inspect=9242" }, { 'id': 'order-server-1', 'host': '172.26.145.159', 'port': 6060, "args": " --inspect=9242" },
] ]
}, },
'dev': { 'dev': {
'connector': [ 'connector': [
{ 'id': 'connector-server-1', 'port': 4050, 'clientHost': 'zyzdev.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3050, 'frontend': true, "args": " --inspect=9237" }, { 'id': 'connector-server-1', 'port': 4050, 'clientHost': 'zyzdev.trgame.cn', 'host': '172.26.145.161', 'clientPort': 3050, 'frontend': true, "args": " --inspect=9237" },
{ 'id': 'connector-server-2', 'port': 4051, 'clientHost': 'zyzdev.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3051, 'frontend': true, "args": " --inspect=9229" }, { 'id': 'connector-server-2', 'port': 4051, 'clientHost': 'zyzdev.trgame.cn', 'host': '172.26.145.161', 'clientPort': 3051, 'frontend': true, "args": " --inspect=9229" },
{ 'id': 'connector-server-3', 'port': 4052, 'clientHost': 'zyzdev.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3052, 'frontend': true, "args": " --inspect=9238" } { 'id': 'connector-server-3', 'port': 4052, 'clientHost': 'zyzdev.trgame.cn', 'host': '172.26.145.161', 'clientPort': 3052, 'frontend': true, "args": " --inspect=9238" }
], ],
'chat': [ 'chat': [
{ 'id': 'chat-server-1', 'host': '172.26.145.161', 'port': 6050, "args": " --inspect=9234" }, { 'id': 'chat-server-1', 'host': '172.26.145.161', 'port': 6050, "args": " --inspect=9234" },
@@ -159,10 +159,10 @@ module.exports = {
{ 'id': 'battle-server-1', 'host': '172.26.145.161', 'port': 6054, "args": " --inspect=9230" } { 'id': 'battle-server-1', 'host': '172.26.145.161', 'port': 6054, "args": " --inspect=9230" }
], ],
'gate': [ 'gate': [
{ 'id': 'gate-server-1', 'host': '127.0.0.1', 'clientHost': 'zyzdev.trgame.cn', 'clientPort': 3014, 'frontend': true, "args": " --inspect=9227" }, { 'id': 'gate-server-1', 'host': '172.26.145.161', 'clientHost': 'zyzdev.trgame.cn', 'clientPort': 3014, 'frontend': true, "args": " --inspect=9227" },
{ {
'id': 'gate-server-2', 'id': 'gate-server-2',
'host': '127.0.0.1', 'host': '172.26.145.161',
'clientHost': 'zyzdev.trgame.cn', 'clientHost': 'zyzdev.trgame.cn',
'clientPort': 3015, 'clientPort': 3015,
'frontend': true, 'frontend': true,