memdb.conf.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. // Copyright 2015 MemDB.
  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/fhmj?authSource=admin', // 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: 1,
  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: 1,
  42. },
  43. // Log settings
  44. log: {
  45. // Log file path
  46. path : './logs/memdbcluster',
  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. shards: {
  63. mjconnector1: {
  64. host: '127.0.0.1',
  65. bind: '127.0.0.1',
  66. port: 61017
  67. },
  68. mjconnector2: {
  69. host: '127.0.0.1',
  70. bind: '127.0.0.1',
  71. port: 61027
  72. },
  73. mjconnector3: {
  74. host: '127.0.0.1',
  75. bind: '127.0.0.1',
  76. port: 61037
  77. },
  78. increaser: {
  79. host: '127.0.0.1',
  80. bind: '127.0.0.1',
  81. port: 61097
  82. },
  83. mjgame10: {
  84. host: '127.0.0.1',
  85. bind: '127.0.0.1',
  86. port: 61107
  87. },
  88. mjgame11: {
  89. host: '127.0.0.1',
  90. bind: '127.0.0.1',
  91. port: 61117
  92. },
  93. mjgame12: {
  94. host: '127.0.0.1',
  95. bind: '127.0.0.1',
  96. port: 61127
  97. },
  98. mjgame13: {
  99. host: '127.0.0.1',
  100. bind: '127.0.0.1',
  101. port: 61137
  102. },
  103. mjgame14: {
  104. host: '127.0.0.1',
  105. bind: '127.0.0.1',
  106. port: 61147
  107. },
  108. mjhall1: {
  109. host: '127.0.0.1',
  110. bind: '127.0.0.1',
  111. port: 62017
  112. },
  113. mjhall2: {
  114. host: '127.0.0.1',
  115. bind: '127.0.0.1',
  116. port: 62027
  117. },
  118. mjhall3: {
  119. host: '127.0.0.1',
  120. bind: '127.0.0.1',
  121. port: 62037
  122. },
  123. mjhttp1: {
  124. host: '127.0.0.1',
  125. bind: '127.0.0.1',
  126. port: 62107
  127. }
  128. },
  129. // *** additional settings ***
  130. // These settings are unstable and may change in later version
  131. // Delay for flush changes to backend storage
  132. // Set it to large value to improve performance if the data delay in backend storage is not an issue.
  133. persistentDelay : 0, // 600 * 1000, // number in ms, default 10 min. 0 indicates never
  134. // Idle time before document is removed from memory.
  135. // Larger value can improve performance but use more memory.
  136. // Set it to large value if the documents accessed via this shard is limited.
  137. // Do not access too many different documents in a short time, which may exhault memory and trigger heavy GC operation.
  138. // idleTimeout : 1800 * 1000, // number in ms, default 30 min. 0 indicates never
  139. // GC will be triggered when memory usage reach this limit
  140. // GC can be very heavy, please adjust idleTimeout to avoid GC.
  141. // memoryLimit : 1024, // number in MB, default 1024
  142. // Disable redis replica, DO NOT turn on this in production.
  143. // disableSlave : false, // default false
  144. // Slow query time
  145. // slowQuery : 2000, // number in ms. default 2000
  146. // Turn on heapdump module (https://www.npmjs.com/package/heapdump)
  147. // heapdump : false, // default false
  148. };