tool.txt 12 KB

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