@zhangyy
2021-01-28T08:37:40.000000Z
字数 5357
阅读 315
ElasticSearch系列










ES的分片



ES 的路由





ES 怎么存放文档

ES 怎么搜索文档


mkdir -p /esdbmkdir -p /esdb/soft将所有的软件传到/esdb/soft 软件下面chown esadmin:esadmin -R /esdb/

配置jdksu - esadmincd /esdb/tar zxvf soft/jdk-14.0.2_linux-x64_bin.tar.gzexport LANG=en_US.UTF8cat >> ~/.bash_profile << EOFexport JAVA_HOME=/esdb/jdk-14.0.2export PATH=/esdb/jdk-14.0.2/bin:$PATHexport LANG=en_US.UTF8EOFsource ~/.bash_profilejava -version

mkdir -p /esdb/esapp/esapp9201mkdir -p /esdb/esapp/esapp9202mkdir -p /esdb/esapp/esapp9203mkdir -p /esdb/esdata/esdata9201mkdir -p /esdb/esdata/esdata9202mkdir -p /esdb/esdata/esdata9203mkdir -p /esdb/eslog/eslog9201mkdir -p /esdb/eslog/eslog9202mkdir -p /esdb/eslog/eslog9203

cd /esdb/softtar -zxvf /esdb/soft/elasticsearch-7.9.0-linux-x86_64.tar.gzcp -ap /esdb/soft/elasticsearch-7.9.0/* /esdb/esapp/esapp9201/cp -ap /esdb/soft/elasticsearch-7.9.0/* /esdb/esapp/esapp9202/cp -ap /esdb/soft/elasticsearch-7.9.0/* /esdb/esapp/esapp9203/

vim /esdb/esapp/esapp9201/config/elasticsearch.yml----cluster.name: flyfishescluster1node.name: flyfish01-node-1path.data: /esdb/esdata/esdata9201path.logs: /esdb/eslog/eslog9201node.master: truenode.data: truecluster.remote.connect: falsebootstrap.memory_lock: truebootstrap.system_call_filter: falsenetwork.host: 192.168.100.31http.port: 9201transport.tcp.port: 9301http.cors.enabled: truehttp.cors.allow-origin: "*"discovery.seed_hosts: ["192.168.100.31:9301","192.168.100.31:9302","192.168.100.31:9303"]discovery.zen.fd.ping_timeout: 60sdiscovery.zen.fd.ping_retries: 5cluster.initial_master_nodes: ["flyfish01-node-1","flyfish01-node-2","flyfish01-node-3"]----
vim /esdb/esapp/esapp9202/config/elasticsearch.yml----cluster.name: flyfishescluster1node.name: flyfish01-node-2path.data: /esdb/esdata/esdata9202path.logs: /esdb/eslog/eslog9202node.master: truenode.data: truecluster.remote.connect: falsebootstrap.memory_lock: truebootstrap.system_call_filter: falsenetwork.host: 192.168.100.31http.port: 9202transport.tcp.port: 9302http.cors.enabled: truehttp.cors.allow-origin: "*"discovery.seed_hosts: ["192.168.100.31:9301", "192.168.100.31:9302", "192.168.100.31:9303"]discovery.zen.fd.ping_timeout: 60sdiscovery.zen.fd.ping_retries: 5cluster.initial_master_nodes: ["flyfish01-node-1", "flyfish01-node-2","flyfish01-node-3"]-----
vim /esdb/esapp/esapp9203/config/elasticsearch.yml-----cluster.name: flyfishescluster1node.name: flyfish01-node-3path.data: /esdb/esdata/esdata9203path.logs: /esdb/eslog/eslog9203node.master: truenode.data: truecluster.remote.connect: falsebootstrap.memory_lock: truebootstrap.system_call_filter: falsenetwork.host: 192.168.100.31http.port: 9203transport.tcp.port: 9303http.cors.enabled: truehttp.cors.allow-origin: "*"discovery.seed_hosts: ["192.168.100.31:9300","192.168.100.31:9301","192.168.100.31:9302"]discovery.zen.fd.ping_timeout: 60sdiscovery.zen.fd.ping_retries: 5cluster.initial_master_nodes: ["flyfish01-node-1", "flyfish01-node-2","flyfish01-node-3"]-----
vim /esdb/esapp/esapp9201/bin/elasticsearch-envvim /esdb/esapp/esapp9202/bin/elasticsearch-envvim /esdb/esapp/esapp9203/bin/elasticsearch-env都加上:----export JAVA_HOME=/esdb/jdk-14.0.2export PATH=$JAVA_HOME/bin:$PATH----
vim /esdb/esapp/esapp9201/config/jvm.options-----Xms512m-Xmx512m-Xmn256km-Xss228K-XX:+DisableExplicitGC-XX:HeapDumpPath=/esdb/eslog/eslog9201-XX:ErrorFile=/esdb/eslog/eslog9201/hs_err_pid%p.log9-:-Xlog:gc*,gc+age=trace,safepoint:file=/esdb/eslog/eslog9201/gc.log:utctime,pid,tags:filecount=32,filesize=64m----vim /esdb/esapp/esapp9202/config/jvm.options-----Xms512m-Xmx512m-Xmn256km-Xss228K-XX:+DisableExplicitGC-XX:HeapDumpPath=/esdb/eslog/eslog9202-XX:ErrorFile=/esdb/eslog/eslog9202/hs_err_pid%p.log9-:-Xlog:gc*,gc+age=trace,safepoint:file=/esdb/eslog/eslog9202/gc.log:utctime,pid,tags:filecount=32,filesize=64m----vim /esdb/esapp/esapp9203/config/jvm.options------Xms512m-Xmx512m-Xmn256km-Xss228K-XX:+DisableExplicitGC-XX:HeapDumpPath=/esdb/eslog/eslog9203-XX:ErrorFile=/esdb/eslog/eslog9203/hs_err_pid%p.log9-:-Xlog:gc*,gc+age=trace,safepoint:file=/esdb/eslog/eslog9203/gc.log:utctime,pid,tags:filecount=32,filesize=64m----
启动:/esdb/esapp/esapp9201/bin/elasticsearch/esdb/esapp/esapp9202/bin/elasticsearch/esdb/esapp/esapp9203/bin/elasticsearch测试:curl http://192.168.100.31:9201/_cat/nodescurl http://192.168.100.31:9202/_cat/nodescurl http://192.168.100.31:9203/_cat/nodes





后台启动:nohup /esdb/esapp/esapp9201/bin/elasticsearch > /esdb/eslog/eslog9201/esapp9201.nohup &nohup /esdb/esapp/esapp9202/bin/elasticsearch > /esdb/eslog/eslog9202/esapp9202.nohup &nohup /esdb/esapp/esapp9203/bin/elasticsearch > /esdb/eslog/eslog9203/esapp9203.nohup &

查看集群的状态:curl http://192.168.100.31:9203/_cat/health?pretty -H 'Content-Type: application/json'

插入数据curl -XPOST http://192.168.100.31:9201/itpuxdb/_doc/?pretty -H 'Content-Type:application/json' -d '{"id" : "1","name" : "itpux001","city" : "深圳","course" : "oracle","teacher" : "风哥","pxdate": "20200829"}'

curl -XPOST http://192.168.100.31:9201/itpuxdb/_doc/?pretty -H 'Content-Type:application/json' -d '{"id" : "1","name" : "itpux001","city" : "上海","course" : "bigdata","teacher" : "flyfish","pxdate": "20200829"}'

查找:curl -XPOST 'http://192.168.100.31:9201/itpuxdb/_search?pretty' -H 'Content-Type:application/json'curl -XPOST 'http://192.168.100.31:9202/itpuxdb/_search?pretty' -H 'Content-Type:application/json'curl -XPOST 'http://192.168.100.31:9203/itpuxdb/_search?pretty' -H 'Content-Type:application/json'

