tool.txt 12 KB

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