elasticsearch7.9.2 安装配置
**
elasticsearch7.9.2 安裝配置
**
1.download
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.2-linux-x86_64.tar.gz
查看日志:
curl 172.16.1.2:9200/_cat/nodes?v
2、JDK環(huán)境配置。。。省略
注意:ElasticSearch對(duì)jdk版本要求很嚴(yán)格,我用的jdk11對(duì)應(yīng)ES7.2
3、修改配置文件:/opt/es/elasticsearch-7.2.0/config/elasticsearch.yml
network.host: 172.16.1.2 (內(nèi)網(wǎng)IP)
http.port: 9200
4、啟動(dòng)
進(jìn)入到|/opt/es/elasticsearch-7.2.0/bin/,啟動(dòng)命令:./elasticsearch &
nohup ./bin/elasticsearch > /dev/null 2>&1 &
注意: 管理頁(yè)面是另外安裝的。
ElasticSearch7.x—head插件安裝
一、下載 elasticsearch-head-master.zip
下載地址:https://github.com/mobz/elasticsearch-head
二、下載node.js
解壓下載的es-head插件,cd到解壓目錄,下載nodejs,并安裝:
elasticsearch-head-master]# curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -
elasticsearch-head-master]# yum install -y nodejs
查看是否安裝成功:
elasticsearch-head-master]# node -v
v10.16.0
elasticsearch-head-master]# npm -v
6.9.0
三、安裝grunt
elasticsearch-head-master]# npm install -g grunt-cli
elasticsearch-head-master]# npm install
四、修改es配置,加入如下內(nèi)容
http.cors.enabled: true
http.cors.allow-origin: “*”
作用是開啟HTTP對(duì)外提供服務(wù),使Head插件能夠訪問(wèn)Elasticsearch,修改完成后需要重啟es。
五、修改head配置,
打開elasticsearch-head-master/Gruntfile.js,找到connect屬性,修改hostname的值為es的IP:
server: {
options: {
hostname: ‘127.0.0.1’,
port: 9100,
base: ‘.’,
keepalive: true
}
}
六、啟動(dòng)Head插件
切換到elasticsearch-head-master目錄下,運(yùn)行啟動(dòng)命令:
grunt server
啟動(dòng)成功后,輸出如下信息:
Running “connect:server” (connect) task
Waiting forever…
Started connect web server on http://localhost:9100
執(zhí)行 npm install
執(zhí)行 npm run start (npm run start &)
netstat -nltp
看到9100端口開啟,表示安裝成功了
可以在瀏覽器登錄
安裝導(dǎo)入導(dǎo)出工具。
安裝 analysis-icu ICU 分析插件,命令如下:
bin/elasticsearch-plugin install analysis-icu
bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.9.2/elasticsearch-analysis-ik-7.9.2.zip
查看已安裝插件。
bin/elasticsearch-plugin list
使用命令行:
2)./elasticdump --input=http://192.168.10.10:9200/or --output=http://192.168.10.20:9200/newOr --type=data
添加mysql8.0.18連接器
默認(rèn)canal-adapter的lib中只有mysql5.x版本的連接器
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.18/mysql-connector-java-8.0.18.jar
mv mysql-connector-java-8.0.18.jar /usr/local/canal-adapter/lib/
chmod 777 /usr/local/canal-adapter/lib/mysql-connector-java-8.0.18.jar #權(quán)限修改與其它lib庫(kù)一致
chmod +st /usr/local/canal-adapter/lib/mysql-connector-java-8.0.18.jar
重建立索引:
curl -XDELETE http://172.16.1.202:9200/nt_product
curl -XDELETE http://172.16.1.202:9200/nt_news
curl -XDELETE http://172.16.1.202:9200/nt_plan
curl -XPUT -H “Content-Type: application/json” http://172.16.1.202:9200/nt_product?include_type_name=true -d “@nt_product.json”
curl -XPUT -H “Content-Type: application/json” http://172.16.1.202:9200/nt_news?include_type_name=true -d “@nt_news.json”
curl -XPUT -H “Content-Type: application/json” http://172.16.1.202:9200/nt_plan?include_type_name=true -d “@nt_plan.json”
全量同步一次數(shù)據(jù)
curl http://172.16.1.2:38081/etl/es/nt_product.yml -XPOST
curl http://172.16.1.2:38081/etl/es/nt_news.yml -XPOST
curl http://172.16.1.2:38081/etl/es/nt_plan.yml -XPOST
curl http://127.0.0.1:38081/etl/es/nt_product.yml -X POST
{“timestamp”:“2020-09-23 11:20:17”,“status”:500,“error”:“Internal Server Error”,“message”:"Extension instance(name: es, class: interface com.alibaba.otter.canal.client.adapter.OuterAdapter)
Elasticsearch:analyzer [ik_max_word] not found for field [name] 異常處理
[root@nctest004 esindex]# curl -XPUT -H “Content-Type: application/json” http://172.16.1.2:9200/nt_product?include_type_name=true -d “@nt_product.json”
{“error”:{“root_cause”:[{“type”:“mapper_parsing_exception”,“reason”:“analyzer [ik_max_word] not found for field [product_subheading]”}],
“type”:“mapper_parsing_exception”,“reason”:“Failed to parse mapping [product_doc]: analyzer [ik_max_word] not found for field [product_subheading]”,
“caused_by”:{“type”:“mapper_parsing_exception”,“reason”:“analyzer [ik_max_word] not found for field [product_subheading]”}},“status”:400}[root@nctest004 esindex]#
原因:IK分詞器插件 未安裝;
安裝插件:
elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.9.2/elasticsearch-analysis-ik-7.9.2.zip
完成后重啟服務(wù)。再建立索引錯(cuò)誤解除。
啟動(dòng)問(wèn)題處理:
ERROR: [5] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: memory locking requested for elasticsearch process but memory is not locked
[3]: max number of threads [1024] for user [wangxiang] is too low, increase to at least [4096]
[4]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[5]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
1.修改vi /etc/security/limits.conf文件,增加配置
- soft nofile 65536
- hard nofile 65536
- soft memlock unlimited
- hard memlock unlimited
備注:* 代表Linux所有用戶名稱
- soft nproc 4096
- hard nproc 4096
修改/etc/sysctl.conf文件,增加配置
vm.max_map_count=262144
或者
vm.max_map_count=655360
執(zhí)行命令sysctl -p生效
在elasticsearch.yml中添加配置項(xiàng)
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
6、在elasticsearch.yml中修改配置項(xiàng)
node.name: node-1
cluster.initial_master_nodes: [“node-1”]
驗(yàn)證安裝是否完成:
http://47.105.208.102:9200
{
“name” : “node-1”,
“cluster_name” : “elasticsearch”,
“cluster_uuid” : “8RtjsFdTRZ2tQh1Cwahrow”,
“version” : {
“number” : “7.9.1”,
“build_flavor” : “default”,
“build_type” : “tar”,
“build_hash” : “083627f112ba94dffc1232e8b42b73492789ef91”,
“build_date” : “2020-09-01T21:22:21.964974Z”,
“build_snapshot” : false,
“l(fā)ucene_version” : “8.6.2”,
“minimum_wire_compatibility_version” : “6.8.0”,
“minimum_index_compatibility_version” : “6.0.0-beta1”
},
“tagline” : “You Know, for Search”
}
http://47.105.208.102:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.16.1.2 17 98 21 0.67 0.85 0.96 dilmrt * node-1
通過(guò) CURL 命令來(lái)上手操作一下,我們嘗試創(chuàng)建一個(gè)商品索引, 看下效果:
[root@nctest004 config]# curl -X PUT “172.16.1.2:9200/commodity?pretty”
{
“acknowledged” : true,
“shards_acknowledged” : true,
“index” : “commodity”
}
總結(jié)
以上是生活随笔為你收集整理的elasticsearch7.9.2 安装配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: MYSQL数据同步到ES7
- 下一篇: Dataguru培训优惠码 分享