1,修改服务端文件/data/server_5601/Config/ServerConfigList.txt 复制一区的字段,开几个区复制几个

如图所示:

里面需要改的是:

  1. 5601是一区,二区就是5602以此类推
  2. 56001是一区,二区就是56002以此类推
  3. actor_5601是一区,二区就是actor_5602以此类推
  4. log_5601是一区,二区就是log_5601以此类推

 

2,导入数据库:这里是四个区的配置,复制到ssh里面运行

  1. HOSTNAME=“localhost”
  2. PORT=“3306”
  3. USERNAME=“root”
  4. PASSWORD=“123456”
  5. DB1=“actor_5602”
  6. DB2=“actor_5603”
  7. DB3=“actor_5604”
  8. DB4=“log_5602”
  9. DB5=“log_5603”
  10. DB6=“log_5604”
  11. sql1=“create database ${DB1} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;”
  12. sql2=“create database ${DB2} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;”
  13. sql3=“create database ${DB3} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;”
  14. sql4=“create database ${DB4} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;”
  15. sql5=“create database ${DB5} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;”
  16. sql6=“create database ${DB6} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;”
  17. mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} -e ${sql1}
  18. mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} -e ${sql2}
  19. mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} -e ${sql3}
  20. mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} -e ${sql4}
  21. mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} -e ${sql5}
  22. mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} -e ${sql6}
  23. mysql -u${USERNAME} -p${PASSWORD} ${DB1} < /data/sql/actor_5601.sql
  24. mysql -u${USERNAME} -p${PASSWORD} ${DB2} < /data/sql/actor_5601.sql
  25. mysql -u${USERNAME} -p${PASSWORD} ${DB3} < /data/sql/actor_5601.sql
  26. mysql -u${USERNAME} -p${PASSWORD} ${DB4} < /data/sql/log_5601.sql
  27. mysql -u${USERNAME} -p${PASSWORD} ${DB5} < /data/sql/log_5601.sql
  28. mysql -u${USERNAME} -p${PASSWORD} ${DB6} < /data/sql/log_5601.sql

3,修改服务器列表\data\www\serverlist.txt

  1. 1 外网 一区 139.155.232.43 5601
  2. 2 外网 二区 139.155.232.43 5602
  3. 3 外网 三区 139.155.232.43 5603
  4. 4 外网 四区 139.155.232.43 5604

4,启动四个区

  1. cd /data/server_5601 &&  nohup ./5601 -worldid 5601 -assert 1 &  //这是一区
  2. cd /data/server_5601 &&  nohup ./5601 -worldid 5602 -assert 1 &  //这是二区
  3. cd /data/server_5601 &&  nohup ./5601 -worldid 5603 -assert 1 &  //这是三区
  4. cd /data/server_5601 &&  nohup ./5601 -worldid 5604 -assert 1 &  //这是四区

5,后台配置多区

先修改\data\www\gm\config\config.php添加2 3 4区数据库配置,

如下所示:

  1. $qus=array(
  2. ‘1’=> array(
  3. ‘name’=> ‘一区’,
  4. ‘DB_NAME’=> ‘actor_5601’,
  5. ‘SERVER_ID’=> ‘5601’
  6. )
  7. ,
  8. ‘2’=> array(
  9. ‘name’=> ‘二区’,
  10. ‘DB_NAME’=> ‘actor_5602’,
  11. ‘SERVER_ID’=> ‘5602’
  12. ),
  13. ‘3’=> array(
  14. ‘name’=> ‘三区’,
  15. ‘DB_NAME’=> ‘actor_5603’,
  16. ‘SERVER_ID’=> ‘5603’
  17. ),
  18. ‘4’=> array(
  19. ‘name’=> ‘四区’,
  20. ‘DB_NAME’=> ‘actor_5604’,
  21. ‘SERVER_ID’=> ‘5604’
  22. ),
  23. );
姐妹花资源网提示:©版权免责声明