ElasticSearch鎺掑簭寮曡捣鐨刟ll shards failed寮傚父鍘熷洜鍒嗘瀽

鑳屾櫙

娉細ElasticSearch鐗堟湰涓�5.4銆�

鍦ㄦ垜浠殑鏃ュ織绯荤粺閲岄渶瑕佷竴浜涚郴缁熺储寮曪紝杩欎簺绯荤粺绱㈠紩鍦ㄥ簲鐢ㄥ垵濮嬪寲鐨勬椂鍊欏氨浼氳娣诲姞鍒癊lasticSearch涓幓锛岃繖浜涘湪ElasticSearch涓殑绯荤粺绱㈠紩鍦ㄦ病鏈夌储寮曟暟鎹殑鏃跺�欙紝鍙湁绱㈠紩鍚嶅拰涓�浜涢厤缃俊鎭紝娌℃湁mapping淇℃伅銆傚綋鐢ㄦ埛鍘绘牴鎹椂闂村尯闂存帓搴忔悳绱㈡棩蹇椾俊鎭殑鏃跺�欙紝ElasticSearch灏变細浜х敓all shards failed寮傚父銆傚叿浣撳紓甯镐俊鎭涓嬶細

Caused by: [.alert/NXa3zq5WSb-wGBKgyZibzw] QueryShardException[No mapping foundfor[timestamp]inorder to sort on]at org.ElasticSearch.search.sort.FieldSortBuilder.build(FieldSortBuilder.java:262)at org.ElasticSearch.search.sort.SortBuilder.buildSort(SortBuilder.java:156)at org.ElasticSearch.search.SearchService.parseSource(SearchService.java:617)at org.ElasticSearch.search.SearchService.createContext(SearchService.java:468)at org.ElasticSearch.search.SearchService.createAndPutContext(SearchService.java:444)at org.ElasticSearch.search.SearchService.executeQueryPhase(SearchService.java:252)at org.ElasticSearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:331)at org.ElasticSearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:328)at org.ElasticSearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)at org.ElasticSearch.transport.TransportService$7.doRun(TransportService.java:627)at org.ElasticSearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638)at org.ElasticSearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)... 3 more

鏌ョ湅浜�.alert鐨勭储寮曟暟鎹啀缁撳悎ElasticSearch鐨勫紓甯镐俊鎭垽鏂紝鎴戞��鐤戞槸鐢变簬.alert绯荤粺绱㈠紩娌℃湁timestamp mapping淇℃伅寮曡捣鐨勶紝.alert绱㈠紩鍒濆鍖栨病鏈変换浣曟暟鎹椂锛孍lasticSearch涓殑淇℃伅濡備笅锛�

http://dev:9200/.alert

{".alert": {"aliases": {"alert": {}聽 聽 聽 聽 },"mappings": {"alert": {}聽 聽 聽 聽 },"settings": {"index": {"refresh_interval":"-1","number_of_shards":"5","provided_name":".alert","creation_date":"1533613744728","store": {"type":"fs"},"number_of_replicas":"1","uuid":"YuPjsObOTMO6u3fEdG6hVw","version": {"created":"5040099"}聽 聽 聽 聽 聽 聽 }聽 聽 聽 聽 }聽 聽 }}

鐪嬪埌杩欎簺淇℃伅涔嬪悗锛屾垜寮�濮嬩簡鐢ㄤ互涓嬫柟娉曞皾璇曡В鍐炽��

瑙e喅鏂规硶

浠ヤ笅鏂规硶1鍜屾柟娉�2閮戒互澶辫触鑰屽憡缁堬紝鍙湁鏂规硶3鍙互鎴愬姛瑙e喅璇ラ棶棰樸�備絾鍦ㄨВ鍐抽棶棰樹腑鎴戞煡鎵句簡寰堝璧勬枡锛岃鎴戝ElasticSearch鐨刴apping鏈変簡鏇存繁鍦扮悊瑙o紝鍥犳鎴戝皢瑙e喅璇ラ棶棰樼殑杩囩▼璁板綍浜嗕笅鏉ャ��

鏂规硶1锛氭坊鍔犵储寮曟ā鏉�

棣栧厛锛岀敱浜庢槸娌℃湁timestamp杩欎釜mapping淇℃伅锛屽洜姝ゆ垜鎯冲埌鍒涘缓绱㈠紩妯℃澘锛屽皢.alert杩欎釜绱㈠紩鐨刴appings淇℃伅鐢ㄦā鏉挎潵璁剧疆锛屼互渚垮湪绱㈠紩鍒涘缓鐨勬椂鍊欏氨鏈夌浉搴旂殑mapping淇℃伅銆傛ā鏉夸俊鎭涓嬶細

{"alert": {"order":0,"template":"alert","settings": {"index": {"number_of_shards":"5","number_of_replicas":"1","refresh_interval":"2s"}聽 聽 聽 聽 },"mappings": {"alert": {"properties": {"timestamp": {"type":"date"}聽 聽 聽 聽 聽 聽 聽 聽 }聽 聽 聽 聽 聽 聽 }聽 聽 聽 聽 },"aliases": {}聽 聽 }}

浣嗘槸锛岀粡杩囨祴璇曞悗鍙戠幇锛宎ll shards failed鐨勯棶棰樿繕鏄細浜х敓銆傜┒鍏跺師鍥犳槸鐢变簬锛�

绱㈠紩妯℃澘鍙細鍦ㄦ彃鍏ユ柊绱㈠紩鏁版嵁鐨勬椂鍊欑敓鏁堬紝濡傛灉娌℃湁绱㈠紩鏁版嵁锛岀储寮曟ā鏉垮畾涔夌殑mappings淇℃伅涓嶄細鐢熸晥锛岃�屼笖瀵规ā鏉跨殑鏀瑰彉涓嶄細褰卞搷鍒板凡瀛樺湪鐨勭储寮曘��

姝ゆ椂锛�.alert杩欎釜绱㈠紩涓虹┖锛岃繕娌℃湁鏂版暟鎹彃鍏ワ紝鍥犳锛屾ā鏉夸笉浼氱敓鏁堬紝涔熷氨鑷翠娇璇ユ柟娉曚笉浼氳В鍐砤ll shards failed鐨勯棶棰樸��

鏂规硶2锛氬垱寤虹储寮曟椂娣诲姞mapping

鐢变簬ElasticSearch鍏佽鍦ㄥ垱寤虹储寮曟椂灏卞垱寤簃apping淇℃伅锛屼簬鏄垜鎯冲埌浜嗚繖涓柟娉曪紝缁忚繃娴嬭瘯鍚庯紝鍙互瑙e喅all shards failed鐨勯棶棰樸�備絾鏄紝浜х敓浜嗕竴涓弗閲嶇殑鍚庢灉锛屾垜浠敤.alert绱㈠紩鏉ヨ褰曟湇鍔″櫒鎶ヨ淇℃伅锛屽綋鎴戝線.alert杩欎釜绱㈠紩閲屾坊鍔犳暟鎹椂锛屽彧鏈塼imestamp杩欎釜瀛楁鐨勬暟鎹坊鍔犺繘鍘讳簡锛屽叾浠栨暟鎹儚浜х敓鎶ヨ鐨勪富鏈恒�佹姤璀﹀唴瀹圭瓑淇℃伅娣诲姞澶辫触銆�

鏌ヨ瀹樻柟鏂囨。鍙戠幇锛�

mapping淇℃伅涓�鏃﹁鍒涘缓锛屽氨涓嶅厑璁歌淇敼銆傛敼鍙樺凡鏈夌殑mapping灏辨剰鍛崇潃浣垮凡缁忓瓨鍦ㄧ殑绱㈠紩鏁版嵁鏃犳晥锛岃В鍐崇殑鍔炴硶灏辨槸浣跨敤姝g‘鐨刴appings淇℃伅鏉ュ垱寤烘柊鐨勭储寮曪紝鐒跺悗閲嶆柊鎶婃暟鎹坊鍔犲埌鏂扮储寮曚腑銆傝櫧鐒跺畼鏂规彁渚涗簡reindex鏂规硶鏉ヨВ鍐宠繖涓棶棰橈紝浣嗘槸锛屽湪澶ф暟鎹噺鐨勬儏鍐典笅锛宺eindex浠d环姣旇緝楂橈紝鍥犳锛屽垱寤虹储寮曟椂娣诲姞mapping杩欎釜鏂规硶涔熻涓嶉�氥��

鏂规硶3锛氱粰鎺掑簭鏉′欢鍔爑nmapped_type

ElasticSearch鐨剆earch api鍙互璁剧疆鎺掑簭鏃跺拷鐣ュ瓧娈电殑鍝簺鏄犲皠銆傞粯璁ゆ儏鍐典笅锛屽鏋滄病鏈変笌鎺掑簭瀛楁鍏宠仈鐨勬槧灏勶紝鍒欐悳绱㈣姹傚皢澶辫触銆倁nmapped_type閫夐」鍏佽璁剧疆蹇界暐娌℃湁鏄犲皠鐨勫瓧娈碉紝浠庤�屼笉瀵硅瀛楁鎺掑簭銆傜敱浜巘imestamp鐨刴apping涓篸ate绫诲瀷锛屽洜姝わ紝鍦ㄦ悳绱㈡帓搴忔潯浠朵腑澧炲姞{"timestamp":{"unmapped_type":"date"}}鎴愬姛瑙e喅鐢变簬鎺掑簭瀛楁娌℃湁date鏄犲皠寮曡捣鐨刟ll shards failed闂銆�

鎰熷叴瓒g殑鍙互鑷繁鏉ユ垜鐨凧ava鏋舵瀯缇わ紝鍙互鑾峰彇鍏嶈垂鐨勫涔犺祫鏂欙紝缇ゅ彿锛�855801563瀵笿ava鎶�鏈紝鏋舵瀯鎶�鏈劅鍏磋叮鐨勫悓瀛︼紝娆㈣繋鍔犵兢锛屼竴璧峰涔狅紝鐩镐簰璁ㄨ銆�

你可能感兴趣的:(ElasticSearch鎺掑簭寮曡捣鐨刟ll shards failed寮傚父鍘熷洜鍒嗘瀽)