memdb.conf.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // Copyright 2015 rain1017.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  12. // implied. See the License for the specific language governing
  13. // permissions and limitations under the License. See the AUTHORS file
  14. // for names of contributors.
  15. 'use strict';
  16. /*
  17. * MemDB server config template
  18. *
  19. * Please modify it on your needs
  20. * This is plain javascript, you can add any js code here, just export the config
  21. */
  22. module.exports = {
  23. // *** global settings for all shards ***
  24. // Global backend storage, all shards must connect to the same mongodb (cluster)
  25. backend : {
  26. engine : 'mongodb', // should be 'mongodb'
  27. url : 'mongodb://localhost/quick-pomelo', // mongodb connect string
  28. options : {}, // mongodb connect options
  29. },
  30. // Global locking redis, all shards must connect to the same redis (cluster)
  31. locking : {
  32. host : '127.0.0.1',
  33. port : 6379,
  34. db : 0,
  35. },
  36. // Data replication redis, one redis instance for each shard
  37. // You can override this in shard settings to choice different slave for each shard
  38. slave : {
  39. host : '127.0.0.1',
  40. port : 6379,
  41. db : 0,
  42. },
  43. // Log settings
  44. log : {
  45. // Log file path
  46. //path : '/tmp',
  47. // Log Level (one of 'ALL', 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'OFF')
  48. // Please set to WARN on production
  49. level : 'WARN',
  50. },
  51. // Promise settings
  52. promise : {
  53. // Enable long stack trace, disable it on production
  54. longStackTraces : false,
  55. },
  56. // user for memdbcluster ssh login, default current user
  57. // when start using memdbcluster, make sure you have ssh permission (without password) on all servers,
  58. // and the memdb version, install folder, config files are all the same in all servers
  59. user : process.env.USER,
  60. // Collection settings (for index), modify it on your need
  61. collections : require('./memdb.index'),
  62. // *** Shard specific settings ***
  63. // This will override global settings on specifid shard
  64. shards : {
  65. // shardId
  66. player1 : {
  67. // server IP
  68. host : '127.0.0.1',
  69. // listen port
  70. port : 31017,
  71. // bind Ip
  72. // DO NOT bind to localhost when deploy on multiple servers
  73. // make sure servers can communicate with each other
  74. bind : '0.0.0.0',
  75. // Add any shard specific settings here
  76. // slave : {
  77. // host : '127.0.0.1',
  78. // port : 6379,
  79. // db : 1,
  80. // },
  81. },
  82. // Add more shards
  83. // player2 : {
  84. // host : '127.0.0.1',
  85. // port : 31018,
  86. // },
  87. area1 : {
  88. host : '127.0.0.1',
  89. port : 31027,
  90. },
  91. team1 : {
  92. host : '127.0.0.1',
  93. port : 31037,
  94. },
  95. connector1 : {
  96. host : '127.0.0.1',
  97. port : 31047,
  98. },
  99. },
  100. // *** additional settings ***
  101. // These settings are unstable and may change in later version
  102. // Delay for flush changes to backend storage
  103. // Set it to large value to improve performance if the data delay in backend storage is not an issue.
  104. // persistentDelay : 600 * 1000, // number in ms, default 10 min. 0 indicates never
  105. // Idle time before document is removed from memory.
  106. // Larger value can improve performance but use more memory.
  107. // Set it to large value if the documents accessed via this shard is limited.
  108. // Do not access too many different documents in a short time, which may exhault memory and trigger heavy GC operation.
  109. // idleTimeout : 1800 * 1000, // number in ms, default 30 min. 0 indicates never
  110. // GC will be triggered when memory usage reach this limit
  111. // GC can be very heavy, please adjust idleTimeout to avoid GC.
  112. // memoryLimit : 1024, // number in MB, default 1024
  113. // Disable redis replica, DO NOT turn on this in production.
  114. // disableSlave : false, // default false
  115. // Slow query time
  116. // slowQuery : 2000, // number in ms. default 2000
  117. // Turn on heapdump module (https://www.npmjs.com/package/heapdump)
  118. // heapdump : false, // default false
  119. };