es數(shù)據(jù)的冷熱分離實(shí)驗(yàn)-創(chuàng)新互聯(lián)

注意:演示用的2節(jié)點(diǎn)es,有些參數(shù)配置不太合理,生產(chǎn)環(huán)境還需要更嚴(yán)格的參數(shù)設(shè)定(例如必須開(kāi)啟密碼驗(yàn)證)。

創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括樂(lè)昌網(wǎng)站建設(shè)、樂(lè)昌網(wǎng)站制作、樂(lè)昌網(wǎng)頁(yè)制作以及樂(lè)昌網(wǎng)絡(luò)營(yíng)銷(xiāo)策劃等。多年來(lái),我們專(zhuān)注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,樂(lè)昌網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到樂(lè)昌省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

系統(tǒng)版本:CentOS7

節(jié)點(diǎn)規(guī)劃:

熱數(shù)據(jù)節(jié)點(diǎn):? 192.168.2.4

溫?cái)?shù)據(jù)節(jié)點(diǎn):? 192.168.2.190

PS:這里就沒(méi)分 hot warm cold 這種三級(jí)存儲(chǔ),我們一般使用 hot warm 2種即可。

我們這里使用 tar.gz 通用二進(jìn)制文件

useradd es

# cat /etc/security/limits.d/elasticsearch.conf?

es?-?nofile?65535 es?-?noproc?65535 es?-?memlock?unlimited

cd /usr/local/elasticsearch-7.4.2/

mkdir data logs?

chown es.es? /usr/local/elasticsearch-7.4.2/ -R

su - es

cd /usr/local/elasticsearch-7.4.2/

熱數(shù)據(jù)節(jié)點(diǎn):? 192.168.2.4 的配置如下:

cat config/elasticsearch.yml?

cluster.name:?my-application node.name:?node-1 node.attr.rack:?r1 node.attr.temperature:?hot path.data:?./data/ path.logs:?./logs node.master:?true node.data:?true node.ingest:?true bootstrap.memory_lock:?true network.host:?0.0.0.0 http.port:?9200 cluster.initial_master_nodes:? ??-?192.168.2.4:9300 ??-?192.168.2.190:9300 ?? discovery.seed_hosts: ??-?192.168.2.4 ??-?192.168.2.190 ?? gateway.recover_after_nodes:?1 #action.destructive_requires_name:?true #############?xpack?的配置項(xiàng)?#################### #xpack.security.enabled:?true #xpack.security.transport.ssl.enabled:?true xpack.security.audit.enabled:?true xpack.security.audit.logfile.events.include:?access_denied,?access_granted,?anonymous_access_denied,?authentication_failed,connection_denied,?tampered_request,?run_as_denied,?run_as_granted xpack.security.audit.logfile.emit_node_host_address:?true xpack.security.audit.logfile.emit_node_host_name:?true xpack.sql.enabled:?true xpack.ilm.enabled:?true

溫?cái)?shù)據(jù)節(jié)點(diǎn):? 192.168.2.190

cat config/elasticsearch.yml?

cluster.name:?my-application node.name:?es11 node.attr.rack:?r1 node.attr.temperature:?warm path.data:?./data/ path.logs:?./logs node.master:?true node.data:?true node.ingest:?true bootstrap.memory_lock:?true network.host:?0.0.0.0 http.port:?9200 cluster.initial_master_nodes:? ??-?192.168.2.4:9300 ??-?192.168.2.190:9300 ?? discovery.seed_hosts: ??-?192.168.2.4 ??-?192.168.2.190 gateway.recover_after_nodes:?1 #action.destructive_requires_name:?true #############?xpack?的配置項(xiàng)?#################### #xpack.security.enabled:?true #xpack.security.transport.ssl.enabled:?true xpack.security.audit.enabled:?true xpack.security.audit.logfile.events.include:?access_denied,?access_granted,?anonymous_access_denied,?authentication_failed,connection_denied,?tampered_request,?run_as_denied,?run_as_granted xpack.security.audit.logfile.emit_node_host_address:?true xpack.security.audit.logfile.emit_node_host_name:?true xpack.sql.enabled:?true xpack.ilm.enabled:?true

啟動(dòng)腳本:?

# cat start.sh?

#?es?依賴高版本的jdk?需要先export下 export?JAVA_HOME=./jdk/ nohup?./bin/elasticsearch?>/dev/null?2>&1?&

停止腳本:

# cat stop.sh?

kill?$(jps|?grep?Elasticsearch?|?awk?'{print?$1}')

創(chuàng)建索引,并將數(shù)據(jù)搬遷到hot節(jié)點(diǎn):

curl?-H?'Content-Type:?application/json'?-X?PUT?http://localhost:9200/index-2019.10.19?pretty curl?-H?'Content-Type:?application/json'?-X?PUT?http://localhost:9200/index-2019.10.19/_settings?-d?' { ??"index.routing.allocation.require.temperature":?"hot" }'

es數(shù)據(jù)的冷熱分離實(shí)驗(yàn)

如果要將 index-2019.10.19 的數(shù)據(jù)搬遷到溫節(jié)點(diǎn),我們使用下面的這個(gè)命令就行

curl?-H?'Content-Type:?application/json'?-X?PUT?http://localhost:9200/index-2019.10.19/_settings?-d?' { ??"index.routing.allocation.require.temperature":?"warm" }'

流程跑通后,我們可以寫(xiě)個(gè)腳本,作用有2個(gè):

1、提前創(chuàng)建后一天的索引,并確保將其落到hot節(jié)點(diǎn)

2、將7天前的索引,打標(biāo)簽,存放到es的warm節(jié)點(diǎn)(大容量HDD磁盤(pán)):

#!/bin/bash #?創(chuàng)建新的索引,語(yǔ)句類(lèi)似下面5行,需要根據(jù)自己情況修改(建議使用for循環(huán)創(chuàng)建index) #?curl?-H?'Content-Type:?application/json'?-X?PUT?http://localhost:9200/index-2019.10.19?pretty #?curl?-H?'Content-Type:?application/json'?-X?PUT?http://localhost:9200/index-2019.10.19/_settings?-d?' #?{ #???"index.routing.allocation.require.temperature":?"hot" #?}' day=$(date?+"%Y.%m.%d"?-d?-7day) curl?-H?'Content-Type:?application/json'??-X?PUT?http://192.168.2.4:9200/*-${day}/_settings?-d?' { ??"index.routing.allocation.require.temperature":?"warm" }'

另外, 在es7里面 提供?index-lifecycle-management 這個(gè)功能, 我們?cè)趉ibana 界面里面就可以進(jìn)行配置。 具體可以查閱es官方的文檔(個(gè)人還是比較喜歡用上面的這種腳本的方案)。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

網(wǎng)頁(yè)題目:es數(shù)據(jù)的冷熱分離實(shí)驗(yàn)-創(chuàng)新互聯(lián)
新聞來(lái)源:http://www.muchs.cn/article22/ceshjc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、做網(wǎng)站、ChatGPT、商城網(wǎng)站營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名