tool.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. // 新增某字段mapping
  2. curl -XPUT http://127.0.0.1:19805/projectset/_mapping -u es_all:TopJkO2E_d1x -H 'Content-Type: application/json' -d '
  3. {
  4. "properties": {
  5. "bidendtime": {
  6. "type": "long"
  7. },
  8. "list": {
  9. "properties": {
  10. "bidendtime": {
  11. "type": "long"
  12. }
  13. }
  14. }
  15. }
  16. }'
  17. //新增某字段mapping,es7 版本
  18. curl -XPUT "http://192.168.3.149:9200/bidding_v2/_mapping" -H 'Content-Type: application/json' -d '
  19. {
  20. "properties": {
  21. "dataweight": {
  22. "type": "long"
  23. }
  24. }
  25. }'
  26. curl -XPUT "http://127.0.0.1:19805/projectset/_mapping?pretty" -u es_all:TopJkO2E_d1x -H 'Content-Type: application/json' -d '
  27. {
  28. "properties": {
  29. "review_experts": {
  30. "type": "text",
  31. "fielddata": true
  32. },
  33. "s_winner": {
  34. "type": "text",
  35. "fielddata": true,
  36. "fields": {
  37. "mwinner": {
  38. "type": "text",
  39. "analyzer": "my_ngram"
  40. }
  41. },
  42. "analyzer": "douhao"
  43. }
  44. }
  45. }'
  46. // 默认查询数量
  47. curl -XPUT "http://127.0.0.1:19805/bidding/_settings" -u es_all:TopJkO2E_d1x -H 'Content-Type: application/json' -d '
  48. {
  49. "index.max_result_window": "20000"
  50. }'
  51. //开启节点平衡
  52. curl -XPUT http://127.0.0.1:19805/bidding/_settings -u es_all:TopJkO2E_d1x -H 'content-Type:application/json' -d'{
  53. "transient" : {
  54. "cluster.routing.allocation.enable" : "all"
  55. }
  56. }'
  57. //关闭节点平衡
  58. curl -XPUT http://127.0.0.1:19805/_cluster/settings --user es_all:TopJkO2E_d1x -H 'content-Type:application/json' -d'{
  59. "transient" : {
  60. "cluster.routing.allocation.enable" : "none"
  61. }
  62. }'
  63. //开启节点平衡
  64. curl -XPUT http://127.0.0.1:19805/_cluster/settings --user es_all:TopJkO2E_d1x -H 'content-Type:application/json' -d'{
  65. "transient" : {
  66. "cluster.routing.allocation.enable" : "all"
  67. }
  68. }'
  69. //关闭节点平衡
  70. curl -XPUT http://192.168.3.206:9800/_cluster/settings -d'{
  71. "transient" : {
  72. "cluster.routing.allocation.enable" : "none"
  73. }
  74. }'
  75. //开启节点平衡,es7 环境,需要传递header参数
  76. curl -H 'Content-Type: application/json' -XPUT http://192.168.3.149:9200/_cluster/settings -d'{
  77. "transient" : {
  78. "cluster.routing.allocation.enable" : "all"
  79. }
  80. }'
  81. //关闭节点平衡
  82. curl -H 'Content-Type: application/json' -XPUT http://192.168.3.149:9200/_cluster/settings -d'{
  83. "transient" : {
  84. "cluster.routing.allocation.enable" : "none"
  85. }
  86. }'
  87. //手动移动节点
  88. curl -XPOST 'http://127.0.0.1:9800/_cluster/reroute' -d '{
  89. "commands" : [ {
  90. "move" :
  91. {
  92. "index": "qyxy_v2", "shard": 12,
  93. "from_node": "node_12", "to_node": "node_1"
  94. }
  95. }
  96. ]
  97. }'
  98. //查看节点个数
  99. curl http://localhost:9800/_settings?pretty
  100. //设置节点个数
  101. curl -XPUT 'http://127.0.0.1:9800/projectset_v1/_settings' -d '{
  102. "index.routing.allocation.total_shards_per_node":2
  103. }'
  104. // 分片异常 unsigned
  105. curl -XPOST '192.168.3.206:9800/_cluster/reroute' -d '{
  106. "commands": [{
  107. "allocate": {
  108. "index": "projectset_v1",
  109. "shard": 1,
  110. "node": "node-4",
  111. "allow_primary": 1
  112. }
  113. }]
  114. }'
  115. //新增某字段mapping
  116. curl -XPUT http://127.0.0.1:9800/bidding_v1/bidding/_mapping -d '
  117. {
  118. "properties": {
  119. "isValidFile": {
  120. "type": "boolean"
  121. }
  122. }
  123. }'
  124. curl -XPUT http://127.0.0.1:9800/bidding_v1/bidding/_mapping -d '
  125. {
  126. "properties": {
  127. "dataweight": {
  128. "type": "integer"
  129. }
  130. }
  131. }'
  132. // 恢复mapping文件
  133. curl -XPOST "http://192.168.3.128:9800/bidding/bidding/_mapping?pretty" -d '
  134. {
  135. "bidding": {
  136. "transform": {
  137. "lang": "groovy",
  138. "script": "ctx._source[\"id\"] = ctx._source[\"_id\"]"
  139. },
  140. "_id": {
  141. "path": "_id"
  142. },
  143. "_all": {
  144. "enabled": false
  145. },
  146. "properties": {
  147. "winneraddr": {
  148. "index": "not_analyzed",
  149. "type": "string"
  150. },
  151. "projectcode": {
  152. "index": "not_analyzed",
  153. "type": "string"
  154. },
  155. "channel": {
  156. "index": "not_analyzed",
  157. "type": "string"
  158. },
  159. "projectaddr": {
  160. "index": "not_analyzed",
  161. "type": "string"
  162. },
  163. "contractcode": {
  164. "index": "not_analyzed",
  165. "type": "string"
  166. },
  167. "entidlist": {
  168. "index": "not_analyzed",
  169. "type": "string"
  170. },
  171. "agencyaddr": {
  172. "index": "not_analyzed",
  173. "type": "string"
  174. },
  175. "tagname": {
  176. "analyzer": "douhao",
  177. "type": "string"
  178. },
  179. "toptype": {
  180. "index": "not_analyzed",
  181. "type": "string"
  182. },
  183. "project_duration": {
  184. "type": "long"
  185. },
  186. "bid_guarantee": {
  187. "type": "boolean"
  188. },
  189. "href": {
  190. "index": "not_analyzed",
  191. "type": "string"
  192. },
  193. "id": {
  194. "index": "not_analyzed",
  195. "type": "string"
  196. },
  197. "filetext": {
  198. "analyzer": "my_ngram",
  199. "type": "string"
  200. },
  201. "budget": {
  202. "type": "double"
  203. },
  204. "buyeraddr": {
  205. "index": "not_analyzed",
  206. "type": "string"
  207. },
  208. "area": {
  209. "index": "not_analyzed",
  210. "type": "string"
  211. },
  212. "bidamount": {
  213. "type": "double"
  214. },
  215. "projectname": {
  216. "index": "not_analyzed",
  217. "type": "string",
  218. "fields": {
  219. "pname": {
  220. "type": "string"
  221. }
  222. }
  223. },
  224. "buyertel": {
  225. "index": "not_analyzed",
  226. "type": "string"
  227. },
  228. "project_scale": {
  229. "analyzer": "my_ngram",
  230. "type": "string"
  231. },
  232. "signaturedate": {
  233. "type": "long"
  234. },
  235. "s_winner": {
  236. "analyzer": "douhao",
  237. "type": "string",
  238. "fields": {
  239. "mwinner": {
  240. "analyzer": "my_ngram_title",
  241. "type": "string"
  242. }
  243. }
  244. },
  245. "winnerorder": {
  246. "properties": {
  247. "sortstr": {
  248. "index": "not_analyzed",
  249. "type": "string"
  250. },
  251. "entname": {
  252. "index": "not_analyzed",
  253. "type": "string"
  254. },
  255. "sort": {
  256. "type": "integer"
  257. }
  258. }
  259. },
  260. "supervisorrate": {
  261. "type": "double"
  262. },
  263. "project_completedate": {
  264. "type": "long"
  265. },
  266. "buyer": {
  267. "index": "not_analyzed",
  268. "type": "string",
  269. "fields": {
  270. "mbuyer": {
  271. "analyzer": "my_ngram_title",
  272. "type": "string"
  273. }
  274. }
  275. },
  276. "winner": {
  277. "index": "not_analyzed",
  278. "type": "string"
  279. },
  280. "qualifies": {
  281. "analyzer": "my_ngram",
  282. "type": "string"
  283. },
  284. "district": {
  285. "index": "not_analyzed",
  286. "type": "string"
  287. },
  288. "publishtime": {
  289. "type": "long"
  290. },
  291. "buyerzipcode": {
  292. "index": "not_analyzed",
  293. "type": "string"
  294. },
  295. "detail": {
  296. "analyzer": "my_ngram",
  297. "type": "string"
  298. },
  299. "projectinfo": {
  300. "properties": {
  301. "approvecontent": {
  302. "analyzer": "my_ngram",
  303. "type": "string"
  304. },
  305. "approvenumber": {
  306. "index": "not_analyzed",
  307. "type": "string"
  308. },
  309. "approvecity": {
  310. "index": "not_analyzed",
  311. "type": "string"
  312. },
  313. "approvestatus": {
  314. "index": "not_analyzed",
  315. "type": "string"
  316. },
  317. "approvecode": {
  318. "index": "not_analyzed",
  319. "type": "string"
  320. },
  321. "projecttype": {
  322. "index": "not_analyzed",
  323. "type": "string"
  324. },
  325. "approvetime": {
  326. "index": "not_analyzed",
  327. "type": "string"
  328. },
  329. "approvedept": {
  330. "analyzer": "my_ngram",
  331. "type": "string"
  332. }
  333. }
  334. },
  335. "city": {
  336. "index": "not_analyzed",
  337. "type": "string"
  338. },
  339. "purchasing": {
  340. "analyzer": "my_ngram",
  341. "type": "string"
  342. },
  343. "projectscope": {
  344. "index": "not_analyzed",
  345. "type": "string",
  346. "fields": {
  347. "pscope": {
  348. "analyzer": "my_ngram",
  349. "type": "string"
  350. }
  351. }
  352. },
  353. "agencytel": {
  354. "index": "not_analyzed",
  355. "type": "string"
  356. },
  357. "project_startdate": {
  358. "type": "long"
  359. },
  360. "title": {
  361. "analyzer": "my_ngram_title",
  362. "type": "string"
  363. },
  364. "winnerperson": {
  365. "index": "not_analyzed",
  366. "type": "string"
  367. },
  368. "comeintime": {
  369. "type": "long"
  370. },
  371. "s_topscopeclass": {
  372. "analyzer": "douhao",
  373. "type": "string"
  374. },
  375. "projectperiod": {
  376. "index": "not_analyzed",
  377. "type": "string"
  378. },
  379. "project_timeunit": {
  380. "index": "not_analyzed",
  381. "type": "string"
  382. },
  383. "spidercode": {
  384. "index": "not_analyzed",
  385. "type": "string"
  386. },
  387. "subtype": {
  388. "index": "not_analyzed",
  389. "type": "string"
  390. },
  391. "infoformat": {
  392. "type": "integer"
  393. },
  394. "s_subscopeclass": {
  395. "analyzer": "douhao",
  396. "type": "string"
  397. },
  398. "agency": {
  399. "index": "not_analyzed",
  400. "type": "string",
  401. "fields": {
  402. "magency": {
  403. "analyzer": "my_ngram",
  404. "type": "string"
  405. }
  406. }
  407. },
  408. "agencyperson": {
  409. "index": "not_analyzed",
  410. "type": "string"
  411. },
  412. "bidstatus": {
  413. "index": "not_analyzed",
  414. "type": "string"
  415. },
  416. "payway": {
  417. "index": "not_analyzed",
  418. "type": "string"
  419. },
  420. "winnertel": {
  421. "index": "not_analyzed",
  422. "type": "string"
  423. },
  424. "buyerclass": {
  425. "index": "not_analyzed",
  426. "type": "string"
  427. },
  428. "contract_guarantee": {
  429. "type": "boolean"
  430. },
  431. "site": {
  432. "index": "not_analyzed",
  433. "type": "string"
  434. },
  435. "bidopentime": {
  436. "type": "long"
  437. },
  438. "topscopeclass": {
  439. "index": "not_analyzed",
  440. "type": "string"
  441. },
  442. "buyerperson": {
  443. "index": "not_analyzed",
  444. "type": "string"
  445. },
  446. "purchasinglist": {
  447. "properties": {
  448. "number": {
  449. "type": "double"
  450. },
  451. "itemname": {
  452. "index": "not_analyzed",
  453. "type": "string"
  454. },
  455. "totalprice": {
  456. "type": "double"
  457. },
  458. "unitname": {
  459. "index": "not_analyzed",
  460. "type": "string"
  461. },
  462. "model": {
  463. "analyzer": "my_ngram",
  464. "type": "string"
  465. },
  466. "brandname": {
  467. "analyzer": "my_ngram",
  468. "type": "string"
  469. },
  470. "unitprice": {
  471. "type": "double"
  472. }
  473. }
  474. }
  475. }
  476. }
  477. }'
  478. 命令:
  479. curl -XPUT 'http://127.0.0.1:9902/_cluster/settings' -u elastic:MsOCrY7Yct3sjVvB5gCd -H 'Content-Type: application/json' -d '{
  480. "persistent": {
  481. "ingest.geoip.downloader.enabled": false
  482. }
  483. }'
  484. https://discuss.elastic.co/t/unable-to-start-elasticsearch-after-upgrade-7-17-8-2-timeout-was-exceeded/310960/2
  485. 错误:
  486. [2023-05-17T16:41:14,077][ERROR][o.e.i.g.DatabaseNodeService] [es_1] failed to retrieve database [GeoLite2-Country.mmdb]
  487. org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];