sphinx3.conf 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. #############################################################################
  2. ## data source definition
  3. #############################################################################
  4. source src1
  5. {
  6. type = mysql
  7. sql_host = 127.0.0.1
  8. sql_user = root
  9. sql_pass = rootpassword
  10. sql_db = stg
  11. sql_port = 3306 # optional, default is 3306
  12. sql_query_pre = SET NAMES utf8
  13. sql_query = \
  14. SELECT `nethosts`.`id`, 'ip' AS `title`, `nethosts`.`ip` as value, `users`.`login` \
  15. FROM `nethosts` RIGHT JOIN `users` ON `nethosts`.`ip` = `users`.`ip`
  16. sql_attr_string = login
  17. sql_attr_string = title
  18. sql_field_string = value
  19. sql_ranged_throttle = 0
  20. }
  21. source src2 : src1
  22. {
  23. sql_query = \
  24. SELECT `nethosts`.`id`, 'realname' AS `title`, `users`.`login`, `realname`.`realname` as value \
  25. FROM `nethosts` RIGHT JOIN `users` ON `nethosts`.`ip` = `users`.`ip` JOIN `realname` ON `realname`.`login` = `users`.`login` WHERE `realname`.`realname` <> ''
  26. sql_attr_string = login
  27. sql_attr_string = title
  28. sql_field_string = value
  29. }
  30. source src3 : src1
  31. {
  32. sql_query = \
  33. SELECT `nethosts`.`id`, 'mac' AS `title`, `nethosts`.`mac` AS `value`, `users`.`login` \
  34. FROM `nethosts` RIGHT JOIN `users` ON `nethosts`.`ip` = `users`.`ip`
  35. sql_attr_string = login
  36. sql_attr_string = title
  37. sql_field_string = value
  38. }
  39. source src4 : src1
  40. {
  41. sql_query = \
  42. SELECT `nethosts`.`id`, 'login' AS `title`, `users`.`login` AS `value`, `users`.`login` AS `login` \
  43. FROM `nethosts` RIGHT JOIN `users` ON `nethosts`.`ip` = `users`.`ip`
  44. sql_attr_string = login
  45. sql_attr_string = title
  46. sql_field_string = value
  47. }
  48. source src5 : src1
  49. {
  50. sql_query = \
  51. SELECT nethosts.id, 'address' AS `title`, `users`.`login`,concat(`cityname`, ' ', `streetname`, ' ', `buildnum`, IF(`apt`, concat('/',`apt`), '')) AS `value` \
  52. FROM `users` LEFT JOIN `nethosts` USING (`ip`) \
  53. LEFT JOIN `address` ON (`users`.`login`=`address`.`login`) \
  54. LEFT JOIN `apt` ON (`address`.`aptid`=`apt`.`id`) \
  55. LEFT JOIN `build` ON (`apt`.`buildid`=`build`.`id`) \
  56. LEFT JOIN `street` ON (`build`.`streetid`=`street`.`id`) \
  57. LEFT JOIN `city` ON (`street`.`cityid`=`city`.`id`)
  58. sql_attr_string = login
  59. sql_attr_string = title
  60. sql_field_string = value
  61. }
  62. source src6 : src1
  63. {
  64. sql_query = \
  65. SELECT `nethosts`.`id`, 'mobile' AS `title`, `users`.`login`, `phones`.`mobile` as `value` \
  66. FROM `nethosts` RIGHT JOIN `users` ON `nethosts`.`ip` = `users`.`ip` LEFT JOIN `phones` ON `users`.`login` = `phones`.`login` WHERE `phones`.`mobile` <> ''
  67. sql_attr_string = login
  68. sql_attr_string = title
  69. sql_field_string = value
  70. }
  71. source src7 : src1
  72. {
  73. sql_query = \
  74. SELECT `nethosts`.`id`, 'phone' AS `title`, `users`.`login`, `phones`.`phone` as `value` \
  75. FROM `nethosts` RIGHT JOIN `users` ON `nethosts`.`ip` = `users`.`ip` LEFT JOIN `phones` ON `users`.`login` = `phones`.`login` WHERE `phones`.`phone` <> ''
  76. sql_attr_string = login
  77. sql_attr_string = title
  78. sql_field_string = value
  79. }
  80. source src8 : src1
  81. {
  82. sql_query = \
  83. SELECT `nethosts`.`id`, 'contracts' AS `title`, `users`.`login`, `contracts`.`contract` as `value` \
  84. FROM `nethosts` RIGHT JOIN `users` ON `nethosts`.`ip` = `users`.`ip` LEFT JOIN `contracts` ON `users`.`login` = `contracts`.`login`
  85. sql_attr_string = login
  86. sql_attr_string = title
  87. sql_field_string = value
  88. }
  89. source src9 : src1
  90. {
  91. sql_query = \
  92. SELECT `nethosts`.`id`, 'paymentid' AS `title`, `users`.`login`, `op_customers`.`virtualid` as `value` \
  93. FROM `nethosts` RIGHT JOIN `users` ON `nethosts`.`ip` = `users`.`ip` LEFT JOIN `op_customers` ON `users`.`login` = `op_customers`.`realid`
  94. sql_attr_string = login
  95. sql_attr_string = title
  96. sql_field_string = value
  97. }
  98. source src10 : src1
  99. {
  100. sql_query = SELECT `nethosts`.`id`,'mac' AS `title`,CONCAT(SUBSTRING_INDEX(`nethosts`.`mac`, ':', 1),'-',SUBSTRING_INDEX(SUBSTRING_INDEX(`nethosts`.`mac`,':',2),':', -1),'-',SUBSTRING_INDEX(SUBSTRING_INDEX(`nethosts`.`mac`,':',3),':', -1),'-',SUBSTRING_INDEX(SUBSTRING_INDEX(`nethosts`.`mac`,':',4),':', -1),'-',SUBSTRING_INDEX(SUBSTRING_INDEX(`nethosts`.`mac`,':',5),':', -1),'-',SUBSTRING_INDEX(`nethosts`.`mac`, ':', -1)) as `value`, `users`.`login` FROM `nethosts` RIGHT JOIN `users` USING(`ip`)
  101. sql_attr_string = login
  102. sql_attr_string = title
  103. sql_field_string = value
  104. }
  105. source src11 : src1
  106. {
  107. sql_query = SELECT `nethosts`.`id`,'mac' AS `title`,CONCAT(SUBSTRING_INDEX(`nethosts`.`mac`, ':', 1),SUBSTRING_INDEX(SUBSTRING_INDEX(`nethosts`.`mac`,':',2),':', -1),'.',SUBSTRING_INDEX(SUBSTRING_INDEX(`nethosts`.`mac`,':',3),':', -1),SUBSTRING_INDEX(SUBSTRING_INDEX(`nethosts`.`mac`,':',4),':', -1),'.',SUBSTRING_INDEX(SUBSTRING_INDEX(`nethosts`.`mac`,':',5),':', -1),SUBSTRING_INDEX(`nethosts`.`mac`, ':', -1)) as `value`, `users`.`login` FROM `nethosts` RIGHT JOIN `users` USING(`ip`)
  108. sql_attr_string = login
  109. sql_attr_string = title
  110. sql_field_string = value
  111. }
  112. #############################################################################
  113. ## index definition
  114. #############################################################################
  115. index ip
  116. {
  117. source = src1
  118. path = /opt/sphinx/sphinxdata/ip
  119. mlock = 0
  120. morphology = none
  121. min_word_len = 1
  122. min_prefix_len = 1
  123. # min_infix_len = 2
  124. expand_keywords = 1
  125. # index_exact_words = 1
  126. html_strip = 0
  127. blend_mode = trim_both, skip_pure
  128. # + - : . , ' `
  129. # U+0020
  130. blend_chars = U+002B,U+002D,U+003A,U+002E,U+002C,U+0027,U+0060
  131. }
  132. index mac : ip
  133. {
  134. source = src3
  135. path = /opt/sphinx/sphinxdata/mac
  136. }
  137. index realname : ip
  138. {
  139. source = src2
  140. path = /opt/sphinx/sphinxdata/realname
  141. }
  142. index login : ip
  143. {
  144. source = src4
  145. path = /opt/sphinx/sphinxdata/login
  146. }
  147. index fulladdress : ip
  148. {
  149. source = src5
  150. path = /opt/sphinx/sphinxdata/fulladdres
  151. }
  152. index mobile : ip
  153. {
  154. source = src6
  155. path = /opt/sphinx/sphinxdata/mobile
  156. min_infix_len = 2
  157. }
  158. index phone : ip
  159. {
  160. source = src7
  161. path = /opt/sphinx/sphinxdata/phone
  162. }
  163. index contract : ip
  164. {
  165. source = src8
  166. path = /opt/sphinx/sphinxdata/contract
  167. }
  168. #index paymentid : ip
  169. #{
  170. # source = src9
  171. # path = /opt/sphinx/sphinxdata/paymentid
  172. #}
  173. #index macminus : ip
  174. #{
  175. # source = src10
  176. # path = /opt/sphinx/sphinxdata/macminus
  177. #}
  178. #index macdot : ip
  179. #{
  180. # source = src11
  181. # path = /opt/sphinx/sphinxdata/macdot
  182. #}
  183. #############################################################################
  184. ## indexer settings
  185. #############################################################################
  186. indexer
  187. {
  188. mem_limit = 128M
  189. # max_iops = 40
  190. # max_iosize = 1048576
  191. # max_xmlpipe2_field = 4M
  192. # write_buffer = 1M
  193. # max_file_field_buffer = 32M
  194. # on_file_field_error = skip_document
  195. # lemmatizer_cache = 512M
  196. }
  197. #############################################################################
  198. ## searchd settings
  199. #############################################################################
  200. searchd
  201. {
  202. listen = 127.0.0.1:9312
  203. listen = 127.0.0.1:9306:mysql41
  204. log = /opt/sphinx/sphinxdata/logs/searchd.log
  205. query_log = /opt/sphinx/sphinxdata/logs/query.log
  206. read_timeout = 5
  207. client_timeout = 300
  208. max_children = 30
  209. persistent_connections_limit = 30
  210. pid_file = /opt/sphinx/sphinxdata/searchd.pid
  211. seamless_rotate = 1
  212. preopen_indexes = 1
  213. unlink_old = 1
  214. # attr_flush_period = 900
  215. #mva_updates_pool = 1M
  216. max_packet_size = 8M
  217. max_filters = 256
  218. max_filter_values = 4096
  219. # listen_backlog = 5
  220. # read_buffer = 256K
  221. # read_unhinted = 32K
  222. max_batch_queries = 32
  223. # subtree_docs_cache = 4M
  224. # subtree_hits_cache = 8M
  225. workers = threads # for RT to work
  226. # dist_threads = 4
  227. binlog_path = # disable logging
  228. # binlog_path = /var/data # binlog.001 etc will be created there
  229. # binlog_flush = 2
  230. # binlog_max_log_size = 256M
  231. # thread_stack = 128K
  232. # expansion_limit = 1000
  233. # rt_flush_period = 900
  234. # query_log_format = sphinxql
  235. # mysql_version_string = 5.0.37
  236. # collation_server = utf8_general_ci
  237. # collation_libc_locale = ru_RU.UTF-8
  238. # watchdog = 1
  239. # predicted_time_costs = doc=64, hit=48, skip=2048, match=64
  240. # sphinxql_state = sphinxvars.sql
  241. # rt_merge_iops = 40
  242. # rt_merge_maxiosize = 1M
  243. # ha_ping_interval = 0
  244. # ha_period_karma = 60
  245. # prefork_rotation_throttle = 100
  246. # snippets_file_prefix = /mnt/common/server1/
  247. }
  248. #############################################################################
  249. ## common settings
  250. #############################################################################
  251. common
  252. {
  253. # lemmatizer_base = /usr/local/share/sphinx/dicts
  254. # on_json_attr_error = fail_index
  255. # json_autoconv_numbers = 1
  256. # json_autoconv_keynames = lowercase
  257. # rlp_root = /usr/local/share/sphinx/rlp
  258. # rlp_environment = /usr/local/share/sphinx/rlp/rlp/etc/rlp-environment.xml
  259. # rlp_max_batch_size = 100k
  260. # rlp_max_batch_docs = 100
  261. # plugin_dir = /usr/local/sphinx/lib
  262. }
  263. # --eof--