查看 3045
回复 0
Discuz 分库 一主多从 范例
逆风天

16

主题

0

回帖

105

积分
发表于 2021-12-4 19:58:18
显示全部楼层 阅读模式
Discuz 分库 一主多从 范例
Discuz GIT 官方范例:原始地址点这里

文件 config/config_global.php

  1. <?php
  2. /**
  3.         [Discuz!] (C) 2001-2099 Comsenz Inc.
  4.         config_global.php Build at 2012-07-06 10:16:22
  5. */
  6. $_config = array();
  7. // ----------------------------  CONFIG DB  ----------------------------- //
  8. $db = array(
  9.         'dbhost' => 'localhost',
  10.         'dbuser' => 'root',
  11.         'dbpw' => '111111',
  12.         'dbcharset' => 'gbk',
  13.         'pconnect' => '0',
  14.         'dbname' => 'ultrax',
  15.         'tablepre' => 'pre_'
  16. );
  17. $_config['db']['1'] = $db;

  18. //$_config['db']['1']['slave']['1'] = $db;
  19. //$_config['db']['1']['slave']['1']['weight'] = '0';
  20. //$_config['db']['1']['slave']['2'] = $db;
  21. //$_config['db']['1']['slave']['2']['weight'] = '0';
  22. //$_config['db']['1']['slave']['3'] = $db;
  23. //$_config['db']['1']['slave']['3']['weight'] = '0';

  24. $_config['db']['2'] = $db;
  25. $_config['db']['2']['slave']['1'] = $db;
  26. $_config['db']['2']['slave']['1']['weight'] = '5';
  27. $_config['db']['2']['slave']['2'] = $db;
  28. $_config['db']['2']['slave']['3'] = $db;

  29. $_config['db']['3'] = $db;
  30. $_config['db']['3']['dbname'] = 'ultrax';
  31. $_config['db']['3']['slave']['1'] = $db;
  32. $_config['db']['3']['slave']['2'] = $db;
  33. $_config['db']['3']['slave']['3'] = $db;
  34. $_config['db']['3']['slave']['3']['weight'] = '5';

  35. $_config['db']['slave'] = 1;

  36. $dbthread = '2';
  37. $dbpost = '3';
  38. $_config['db']['map']['forum_debatepost'] = $dbpost;
  39. $_config['db']['map']['forum_post_moderate'] = $dbpost;
  40. $_config['db']['map']['forum_post_tableid'] = $dbpost;
  41. $_config['db']['map']['forum_post'] = $dbpost;
  42. $_config['db']['map']['forum_tradelog'] = $dbthread;
  43. $_config['db']['map']['forum_tradecomment'] = $dbthread;
  44. $_config['db']['map']['forum_trade'] = $dbthread;
  45. $_config['db']['map']['forum_threadmod'] = $dbthread;
  46. $_config['db']['map']['forum_activity'] = $dbthread;
  47. $_config['db']['map']['forum_poll'] = $dbthread;
  48. $_config['db']['map']['forum_thread_moderate'] = $dbthread;
  49. $_config['db']['map']['forum_threadimage'] = $dbthread;
  50. $_config['db']['map']['forum_forumrecommend'] = $dbthread;
  51. $_config['db']['map']['forum_moderator'] = $dbthread;
  52. $_config['db']['map']['common_tagitem'] = $dbthread;
  53. $_config['db']['map']['forum_access'] = $dbthread;
  54. $_config['db']['map']['forum_forumfield'] = $dbthread;
  55. $_config['db']['map']['forum_forum'] = $dbthread;
  56. $_config['db']['map']['forum_thread'] = $dbthread;
  57. $_config['db']['map']['forum_statlog'] = $dbthread;

  58. /** //X876 的测试配置文件
  59. $_config['db']['1']['dbhost'] = 'localhost';
  60. $_config['db']['1']['dbuser'] = 'root';
  61. $_config['db']['1']['dbpw'] = 'root';
  62. $_config['db']['1']['dbcharset'] = 'gbk';
  63. $_config['db']['1']['pconnect'] = '0';
  64. $_config['db']['1']['dbname'] = 'superbase';
  65. $_config['db']['1']['tablepre'] = 'pre_';
  66. $_config['db']['common']['slave_except_table'] = '';
  67. $_config['db']['2']['dbhost'] = '2.cn';
  68. $_config['db']['2']['dbuser'] = 'root';
  69. $_config['db']['2']['dbpw'] = 'root';
  70. $_config['db']['2']['dbcharset'] = 'gbk';
  71. $_config['db']['2']['pconnect'] = '0';
  72. $_config['db']['2']['dbname'] = 'superbase_2';
  73. $_config['db']['2']['tablepre'] = 'pre_';
  74. $_config['db']['3']['dbhost'] = '3.cn';
  75. $_config['db']['3']['dbuser'] = 'root';
  76. $_config['db']['3']['dbpw'] = 'root';
  77. $_config['db']['3']['dbcharset'] = 'gbk';
  78. $_config['db']['3']['pconnect'] = '0';
  79. $_config['db']['3']['dbname'] = 'superbase_3';
  80. $_config['db']['3']['tablepre'] = 'pre_';
  81. $_config['db']['4']['dbhost'] = '4.cn';
  82. $_config['db']['4']['dbuser'] = 'root';
  83. $_config['db']['4']['dbpw'] = 'root';
  84. $_config['db']['4']['dbcharset'] = 'gbk';
  85. $_config['db']['4']['pconnect'] = '0';
  86. $_config['db']['4']['dbname'] = 'superbase_4';
  87. $_config['db']['4']['tablepre'] = 'pre_';
  88. $_config['db']['5']['dbhost'] = '5.cn';
  89. $_config['db']['5']['dbuser'] = 'root';
  90. $_config['db']['5']['dbpw'] = 'root';
  91. $_config['db']['5']['dbcharset'] = 'gbk';
  92. $_config['db']['5']['pconnect'] = '0';
  93. $_config['db']['5']['dbname'] = 'superbase_5';
  94. $_config['db']['5']['tablepre'] = 'pre_';
  95. $_config['db']['6']['dbhost'] = '6.cn';
  96. $_config['db']['6']['dbuser'] = 'root';
  97. $_config['db']['6']['dbpw'] = 'root';
  98. $_config['db']['6']['dbcharset'] = 'gbk';
  99. $_config['db']['6']['pconnect'] = '0';
  100. $_config['db']['6']['dbname'] = 'superbase_6';
  101. $_config['db']['6']['tablepre'] = 'pre_';
  102. $_config['db']['7']['dbhost'] = '7.cn';
  103. $_config['db']['7']['dbuser'] = 'root';
  104. $_config['db']['7']['dbpw'] = 'root';
  105. $_config['db']['7']['dbcharset'] = 'gbk';
  106. $_config['db']['7']['pconnect'] = '0';
  107. $_config['db']['7']['dbname'] = 'superbase_7';
  108. $_config['db']['7']['tablepre'] = 'pre_';
  109. $_config['db']['8']['dbhost'] = '8.cn';
  110. $_config['db']['8']['dbuser'] = 'root';
  111. $_config['db']['8']['dbpw'] = 'root';
  112. $_config['db']['8']['dbcharset'] = 'gbk';
  113. $_config['db']['8']['pconnect'] = '0';
  114. $_config['db']['8']['dbname'] = 'superbase_8';
  115. $_config['db']['8']['tablepre'] = 'pre_';
  116. $_config['db']['9']['dbhost'] = '9.cn';
  117. $_config['db']['9']['dbuser'] = 'root';
  118. $_config['db']['9']['dbpw'] = 'root';
  119. $_config['db']['9']['dbcharset'] = 'gbk';
  120. $_config['db']['9']['pconnect'] = '0';
  121. $_config['db']['9']['dbname'] = 'superbase_9';
  122. $_config['db']['9']['tablepre'] = 'pre_';
  123. $_config['db']['10']['dbhost'] = '10.cn';
  124. $_config['db']['10']['dbuser'] = 'root';
  125. $_config['db']['10']['dbpw'] = 'root';
  126. $_config['db']['10']['dbcharset'] = 'gbk';
  127. $_config['db']['10']['pconnect'] = '0';
  128. $_config['db']['10']['dbname'] = 'superbase_10';
  129. $_config['db']['10']['tablepre'] = 'pre_';
  130. $_config['db']['11']['dbhost'] = '11.cn';
  131. $_config['db']['11']['dbuser'] = 'root';
  132. $_config['db']['11']['dbpw'] = 'root';
  133. $_config['db']['11']['dbcharset'] = 'gbk';
  134. $_config['db']['11']['pconnect'] = '0';
  135. $_config['db']['11']['dbname'] = 'superbase_11';
  136. $_config['db']['11']['tablepre'] = 'pre_';
  137. $_config['db']['12']['dbhost'] = '12.cn';
  138. $_config['db']['12']['dbuser'] = 'root';
  139. $_config['db']['12']['dbpw'] = 'root';
  140. $_config['db']['12']['dbcharset'] = 'gbk';
  141. $_config['db']['12']['pconnect'] = '0';
  142. $_config['db']['12']['dbname'] = 'superbase_12';
  143. $_config['db']['12']['tablepre'] = 'pre_';
  144. $_config['db']['13']['dbhost'] = '13.cn';
  145. $_config['db']['13']['dbuser'] = 'root';
  146. $_config['db']['13']['dbpw'] = 'root';
  147. $_config['db']['13']['dbcharset'] = 'gbk';
  148. $_config['db']['13']['pconnect'] = '0';
  149. $_config['db']['13']['dbname'] = 'superbase_13';
  150. $_config['db']['13']['tablepre'] = 'pre_';
  151. $_config['db']['14']['dbhost'] = '14.cn';
  152. $_config['db']['14']['dbuser'] = 'root';
  153. $_config['db']['14']['dbpw'] = 'root';
  154. $_config['db']['14']['dbcharset'] = 'gbk';
  155. $_config['db']['14']['pconnect'] = '0';
  156. $_config['db']['14']['dbname'] = 'superbase_14';
  157. $_config['db']['14']['tablepre'] = 'pre_';
  158. $_config['db']['15']['dbhost'] = '15.cn';
  159. $_config['db']['15']['dbuser'] = 'root';
  160. $_config['db']['15']['dbpw'] = 'root';
  161. $_config['db']['15']['dbcharset'] = 'gbk';
  162. $_config['db']['15']['pconnect'] = '0';
  163. $_config['db']['15']['dbname'] = 'superbase_15';
  164. $_config['db']['15']['tablepre'] = 'pre_';
  165. $_config['db']['16']['dbhost'] = '16.cn';
  166. $_config['db']['16']['dbuser'] = 'root';
  167. $_config['db']['16']['dbpw'] = 'root';
  168. $_config['db']['16']['dbcharset'] = 'gbk';
  169. $_config['db']['16']['pconnect'] = '0';
  170. $_config['db']['16']['dbname'] = 'superbase_16';
  171. $_config['db']['16']['tablepre'] = 'pre_';
  172. $_config['db']['17']['dbhost'] = '17.cn';
  173. $_config['db']['17']['dbuser'] = 'root';
  174. $_config['db']['17']['dbpw'] = 'root';
  175. $_config['db']['17']['dbcharset'] = 'gbk';
  176. $_config['db']['17']['pconnect'] = '0';
  177. $_config['db']['17']['dbname'] = 'superbase_17';
  178. $_config['db']['17']['tablepre'] = 'pre_';
  179. $_config['db']['18']['dbhost'] = '18.cn';
  180. $_config['db']['18']['dbuser'] = 'root';
  181. $_config['db']['18']['dbpw'] = 'root';
  182. $_config['db']['18']['dbcharset'] = 'gbk';
  183. $_config['db']['18']['pconnect'] = '0';
  184. $_config['db']['18']['dbname'] = 'superbase_18';
  185. $_config['db']['18']['tablepre'] = 'pre_';
  186. $_config['db']['19']['dbhost'] = '19.cn';
  187. $_config['db']['19']['dbuser'] = 'root';
  188. $_config['db']['19']['dbpw'] = 'root';
  189. $_config['db']['19']['dbcharset'] = 'gbk';
  190. $_config['db']['19']['pconnect'] = '0';
  191. $_config['db']['19']['dbname'] = 'superbase_19';
  192. $_config['db']['19']['tablepre'] = 'pre_';
  193. $_config['db']['20']['dbhost'] = '20.cn';
  194. $_config['db']['20']['dbuser'] = 'root';
  195. $_config['db']['20']['dbpw'] = 'root';
  196. $_config['db']['20']['dbcharset'] = 'gbk';
  197. $_config['db']['20']['pconnect'] = '0';
  198. $_config['db']['20']['dbname'] = 'superbase_20';
  199. $_config['db']['20']['tablepre'] = 'pre_';
  200. $_config['db']['map']['common_admincp_perm'] = '2';
  201. $_config['db']['map']['common_admincp_member'] = '2';
  202. $_config['db']['map']['common_mailqueue'] = '3';
  203. $_config['db']['map']['common_mailcron'] = '3';
  204. $_config['db']['map']['common_member_verify_info'] = '4';
  205. $_config['db']['map']['common_member_verify'] = '4';
  206. $_config['db']['map']['common_member_validate'] = '4';
  207. $_config['db']['map']['common_member_field_home_archive'] = '4';
  208. $_config['db']['map']['common_member_field_home'] = '4';
  209. $_config['db']['map']['common_member_field_forum_archive'] = '4';
  210. $_config['db']['map']['common_member_field_forum'] = '4';
  211. $_config['db']['map']['common_member_profile_archive'] = '4';
  212. $_config['db']['map']['common_member_profile'] = '4';
  213. $_config['db']['map']['common_member_status_archive'] = '4';
  214. $_config['db']['map']['common_member_status'] = '4';
  215. $_config['db']['map']['common_member_count_archive'] = '4';
  216. $_config['db']['map']['common_member_count'] = '4';
  217. $_config['db']['map']['common_member_archive'] = '4';
  218. $_config['db']['map']['home_specialuser'] = '4';
  219. $_config['db']['map']['home_show'] = '4';
  220. $_config['db']['map']['common_member'] = '4';
  221. $_config['db']['map']['common_pluginvar'] = '5';
  222. $_config['db']['map']['common_plugin'] = '5';
  223. $_config['db']['map']['forum_imagetype'] = '6';
  224. $_config['db']['map']['common_smiley'] = '6';
  225. $_config['db']['map']['common_stylevar'] = '7';
  226. $_config['db']['map']['common_template'] = '7';
  227. $_config['db']['map']['common_style'] = '7';
  228. $_config['db']['map']['forum_attachment_unused'] = '8';
  229. $_config['db']['map']['forum_attachment'] = '8';
  230. $_config['db']['map']['forum_debatepost'] = '9';
  231. $_config['db']['map']['forum_post_moderate'] = '9';
  232. $_config['db']['map']['forum_post_tableid'] = '9';
  233. $_config['db']['map']['forum_post'] = '9';
  234. $_config['db']['map']['forum_tradelog'] = '10';
  235. $_config['db']['map']['forum_tradecomment'] = '10';
  236. $_config['db']['map']['forum_trade'] = '10';
  237. $_config['db']['map']['forum_threadmod'] = '10';
  238. $_config['db']['map']['forum_activity'] = '10';
  239. $_config['db']['map']['forum_poll'] = '10';
  240. $_config['db']['map']['forum_thread_moderate'] = '10';
  241. $_config['db']['map']['forum_threadimage'] = '10';
  242. $_config['db']['map']['forum_forumrecommend'] = '10';
  243. $_config['db']['map']['forum_moderator'] = '10';
  244. $_config['db']['map']['common_tagitem'] = '10';
  245. $_config['db']['map']['forum_access'] = '10';
  246. $_config['db']['map']['forum_forumfield'] = '10';
  247. $_config['db']['map']['forum_forum'] = '10';
  248. $_config['db']['map']['forum_thread'] = '10';
  249. $_config['db']['map']['forum_statlog'] = '10';
  250. $_config['db']['map']['forum_threadtype'] = '11';
  251. $_config['db']['map']['forum_typeoption'] = '11';
  252. $_config['db']['map']['forum_typevar'] = '11';
  253. $_config['db']['map']['home_blogfield'] = '12';
  254. $_config['db']['map']['home_blog_moderate'] = '12';
  255. $_config['db']['map']['home_blog'] = '12';
  256. $_config['db']['map']['home_pic_moderate'] = '13';
  257. $_config['db']['map']['home_album'] = '13';
  258. $_config['db']['map']['home_picfield'] = '13';
  259. $_config['db']['map']['home_pic'] = '13';
  260. $_config['db']['map']['common_mytask'] = '14';
  261. $_config['db']['map']['common_task'] = '14';
  262. $_config['db']['map']['home_comment_moderate'] = '15';
  263. $_config['db']['map']['home_comment'] = '15';
  264. $_config['db']['map']['home_doing_moderate'] = '16';
  265. $_config['db']['map']['home_doing'] = '16';
  266. $_config['db']['map']['home_share_moderate'] = '17';
  267. $_config['db']['map']['home_share'] = '17';
  268. $_config['db']['map']['portal_article_moderate'] = '18';
  269. $_config['db']['map']['portal_article_title'] = '18';
  270. $_config['db']['map']['portal_article_count'] = '18';
  271. $_config['db']['map']['portal_comment_moderate'] = '19';
  272. $_config['db']['map']['portal_comment'] = '19';
  273. */
  274. // --------------------------  CONFIG MEMORY  --------------------------- //
  275. $_config['memory']['prefix'] = 'Yd1234_';
  276. $_config['memory']['eaccelerator'] = '0';
  277. $_config['memory']['xcache'] = 1;
  278. $_config['memory']['memcache']['server'] = '';
  279. $_config['memory']['memcache']['port'] = 11211;
  280. $_config['memory']['memcache']['pconnect'] = 1;
  281. $_config['memory']['memcache']['timeout'] = 1;
  282. $_config['memory']['apc'] = 1;
  283. $_config['memory']['redis']['server'] = '';
  284. $_config['memory']['redis']['port'] = 6379;
  285. $_config['memory']['redis']['pconnect'] = 1;
  286. $_config['memory']['redis']['timeout'] = '0';
  287. $_config['memory']['redis']['serializer'] = 1;

  288. // ---------------------------  CONFIG CACHE  --------------------------- //
  289. $_config['cache']['main']['type'] = '';
  290. $_config['cache']['main']['file']['path'] = 'data/ultraxcache';
  291. $_config['cache']['type'] = 'sql';

  292. // --------------------------  CONFIG OUTPUT  --------------------------- //
  293. $_config['output']['charset'] = 'gbk';
  294. $_config['output']['forceheader'] = 1;
  295. $_config['output']['gzip'] = '1';
  296. $_config['output']['tplrefresh'] = 1;
  297. $_config['output']['language'] = 'zh_cn';
  298. $_config['output']['staticurl'] = 'static/';
  299. $_config['output']['ajaxvalidate'] = '0';
  300. $_config['output']['iecompatible'] = '0';

  301. // --------------------------  CONFIG COOKIE  --------------------------- //
  302. $_config['cookie']['cookiepre'] = 'DlWe_';
  303. $_config['cookie']['cookiedomain'] = '';
  304. $_config['cookie']['cookiepath'] = '/';

  305. // -------------------------  CONFIG SECURITY  -------------------------- //
  306. $_config['security']['authkey'] = '1dab222dvEFEtjZA';
  307. $_config['security']['urlxssdefend'] = '0';
  308. $_config['security']['attackevasive'] = '0';
  309. $_config['security']['querysafe']['status'] = 1;
  310. $_config['security']['querysafe']['dfunction']['0'] = 'load_file';
  311. $_config['security']['querysafe']['dfunction']['1'] = 'hex';
  312. $_config['security']['querysafe']['dfunction']['2'] = 'substring';
  313. $_config['security']['querysafe']['dfunction']['3'] = 'if';
  314. $_config['security']['querysafe']['dfunction']['4'] = 'ord';
  315. $_config['security']['querysafe']['dfunction']['5'] = 'char';
  316. $_config['security']['querysafe']['daction']['0'] = 'intooutfile';
  317. $_config['security']['querysafe']['daction']['1'] = 'intodumpfile';
  318. $_config['security']['querysafe']['daction']['2'] = 'unionselect';
  319. $_config['security']['querysafe']['daction']['3'] = '(select';
  320. $_config['security']['querysafe']['daction']['4'] = 'unionall';
  321. $_config['security']['querysafe']['daction']['5'] = 'uniondistinct';
  322. $_config['security']['querysafe']['dnote']['0'] = '/*';
  323. $_config['security']['querysafe']['dnote']['1'] = '*/';
  324. $_config['security']['querysafe']['dnote']['2'] = '#';
  325. $_config['security']['querysafe']['dnote']['3'] = '--';
  326. $_config['security']['querysafe']['dnote']['4'] = '"';
  327. $_config['security']['querysafe']['dlikehex'] = 1;
  328. $_config['security']['querysafe']['afullnote'] = 1;

  329. // --------------------------  CONFIG ADMINCP  -------------------------- //
  330. // -------- Founders: $_config['admincp']['founder'] = '1,2,3'; --------- //
  331. $_config['admincp']['founder'] = '859,776,80629';
  332. $_config['admincp']['forcesecques'] = '0';
  333. $_config['admincp']['checkip'] = 1;
  334. $_config['admincp']['runquery'] = 1;
  335. $_config['admincp']['dbimport'] = 1;

  336. // ---------------------------  CONFIG DEBUG  --------------------------- //
  337. $_config['debug'] = 'discuz';

  338. // --------------------------  CONFIG SERVER  --------------------------- //
  339. $_config['server']['id'] = 1;

  340. // -------------------------  CONFIG DOWNLOAD  -------------------------- //
  341. $_config['download']['readmod'] = 2;
  342. $_config['download']['xsendfile']['type'] = '0';
  343. $_config['download']['xsendfile']['dir'] = '/down/';

  344. // --------------------------  CONFIG REMOTE  --------------------------- //
  345. $_config['remote']['on'] = 1;
  346. $_config['remote']['dir'] = 'remote';
  347. $_config['remote']['appkey'] = '62cf0b3c3e6a4c9468e7216839721d8e';
  348. $_config['remote']['cron'] = 1;

  349. // ---------------------------  CONFIG INPUT  --------------------------- //
  350. $_config['input']['compatible'] = '0';


  351. // -------------------  THE END  -------------------- //

  352. ?>
复制代码



您需要登录后才可以回帖 登录 立即注册
QQ 快速回复 返回列表