|
@@ -2,6 +2,8 @@
|
|
|
1,redis中使用命令(举例:将10003的玩家合到10001)
|
|
1,redis中使用命令(举例:将10003的玩家合到10001)
|
|
|
redis-cli -a "tmKjD1ENs3HfZ7adzLJO!" EVAL "local keys = redis.call('HKEYS', 'CUser_ServerId:'); local count = 0; for i,key in ipairs(keys) do if redis.call('HGET', 'CUser_ServerId:', key) == '10031' then redis.call('HSET', 'CUser_ServerId:', key, '10026'); count = count + 1; end; end; return count" 0
|
|
redis-cli -a "tmKjD1ENs3HfZ7adzLJO!" EVAL "local keys = redis.call('HKEYS', 'CUser_ServerId:'); local count = 0; for i,key in ipairs(keys) do if redis.call('HGET', 'CUser_ServerId:', key) == '10031' then redis.call('HSET', 'CUser_ServerId:', key, '10026'); count = count + 1; end; end; return count" 0
|
|
|
|
|
|
|
|
|
|
+redis-cli -n 1 -a "tmKjD1ENs3HfZ7adzLJO!" EVAL "local keys = redis.call('HKEYS', 'CUser_ServerId:'); local count = 0; for i,key in ipairs(keys) do if redis.call('HGET', 'CUser_ServerId:', key) == '20002' then redis.call('HSET', 'CUser_ServerId:', key, '20001'); count = count + 1; end; end; return count" 0
|
|
|
|
|
+
|
|
|
2,更新mongo中的x5_tk_login中的user_info中合服区的等级。
|
|
2,更新mongo中的x5_tk_login中的user_info中合服区的等级。
|
|
|
// 更新服务器s1的玩家等级
|
|
// 更新服务器s1的玩家等级
|
|
|
var server1Db = db.getSiblingDB("m5_x1_game_10001");
|
|
var server1Db = db.getSiblingDB("m5_x1_game_10001");
|
|
@@ -45,9 +47,9 @@ db.getSiblingDB('m5_x1_game_10001').user.insertMany(
|
|
|
|
|
|
|
|
另一中方式:
|
|
另一中方式:
|
|
|
先拷贝出来
|
|
先拷贝出来
|
|
|
-mongodump --uri='mongodb://root:StrongMongoPass123@localhost:27017/m5_x1_game_10007?authSource=admin' --collection user --out /data/mongodb/
|
|
|
|
|
|
|
+mongodump --uri='mongodb://root:StrongMongoPass123@localhost:27017/m5_x2_game_20002?authSource=admin' --collection user --out /data/mongodb/
|
|
|
再插入到目标数据库
|
|
再插入到目标数据库
|
|
|
-mongorestore --uri='mongodb://root:StrongMongoPass123@localhost:27017/?authSource=admin' --db m5_x1_game_10001 --collection user /data/mongodb/m5_x1_game_10002/user.bson
|
|
|
|
|
|
|
+mongorestore --uri='mongodb://root:StrongMongoPass123@localhost:27017/?authSource=admin' --db m5_x2_game_20001 --collection user /data/mongodb/m5_x2_game_20002/user.bson
|
|
|
|
|
|
|
|
db.getSiblingDB('m5_x1_game_10001').guildInfo.insertMany(
|
|
db.getSiblingDB('m5_x1_game_10001').guildInfo.insertMany(
|
|
|
db.getSiblingDB('m5_x1_game_10003').guildInfo.find().toArray(),
|
|
db.getSiblingDB('m5_x1_game_10003').guildInfo.find().toArray(),
|