涉及版本聲明:
Linux: Anolis8.4 64位, 且已經安裝好epel源若专。
Jdk: 1.8.0_11
ElasticSearch: elasticsearch-7.16.2
下載地址:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.16.2-x86_64.rpm
Ik-Analysis: elasticsearch-analysis-ik-7.16.2
下載地址:https://github.com/medcl/elasticsearch-analysis-ik/releases
analysis-pinyin: elasticsearch-analysis-pinyin-7.16.2
下載地址:https://github.com/medcl/elasticsearch-analysis-pinyin/releases
elasticsearch-head: elasticsearch-head5.0.0
下載地址:https://codeload.github.com/mobz/elasticsearch-head/tar.gz/refs/tags/v5.0.0
Elasticsearch與jdk版本對應關系
一伟端、 安裝環(huán)境準備
主機規(guī)劃:192.168.100.86 anolis8
系統(tǒng)配置:
4 VCPU、4G內存顽分、50G硬盤
修改服務器名稱:
hostnamectl set-hostname anolis8
需要修改幾個參數(shù)货矮,不然啟動會報錯
vim /etc/security/limits.conf
在末尾追加以下內容
* soft nofile 65536
* hard nofile 65536
* soft nproc 2048
* hard nproc 2048
* soft memlock unlimited
* hard memlock unlimited
對于systemd service的資源限制补箍,現(xiàn)在放在 /etc/systemd/system.conf
vim /etc/systemd/system.conf
在末尾追加以下內容
DefaultLimitNOFILE=65536
DefaultLimitNPROC=32000
DefaultLimitMEMLOCK=infinity
否則elasticsearch啟動時會報錯:
memory locking requested for elasticsearch process but memory is not locked
這個問題的解決辦法是修改
vim /usr/lib/systemd/system/elasticsearch.service
在文件中添加
LimitMEMLOCK=infinity
保存后退出
systemctl daemon-reload
二、安裝配置
1赦邻、安裝JDK
使用腳本安裝jdk1.8版本
chmod +x jdkinstall.sh
sh jdkinstall.sh
source /etc/profile
[root@anolis8 ~]# java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
2髓棋,安裝elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.16.2-x86_64.rpm
[root@anolis8 ~]# rpm -ivh elasticsearch-7.16.2-x86_64.rpm
[root@anolis8 ~]# ll /etc/elasticsearch/
總用量 44
-rw-rw---- 1 root elasticsearch 199 2月 10 11:04 elasticsearch.keystore
-rw-rw---- 1 root elasticsearch 1042 12月 19 2021 elasticsearch-plugins.example.yml
-rw-rw---- 1 root elasticsearch 3712 2月 10 11:37 elasticsearch.yml
-rw-rw---- 1 root elasticsearch 3344 2月 10 11:40 jvm.options
drwxr-s--- 2 root elasticsearch 6 12月 19 2021 jvm.options.d
-rw-rw---- 1 root elasticsearch 19150 12月 19 2021 log4j2.properties
-rw-rw---- 1 root elasticsearch 473 12月 19 2021 role_mapping.yml
-rw-rw---- 1 root elasticsearch 197 12月 19 2021 roles.yml
-rw-rw---- 1 root elasticsearch 0 12月 19 2021 users
-rw-rw---- 1 root elasticsearch 0 12月 19 2021 users_roles
2.1配置elasticsearch
創(chuàng)建elasticsearch data的存放目錄,并修改該目錄的屬主屬組
# mkdir -p /data/es-data (自定義用于存放data數(shù)據(jù)的目錄)
# chown -R elasticsearch:elasticsearch /data/es-data
修改elasticsearch的日志屬主屬組
# chown -R elasticsearch:elasticsearch /var/log/elasticsearch
修改elasticsearch的配置文件
# vim /etc/elasticsearch/elasticsearch.yml
找到配置文件中的cluster.name惶洲,打開該配置并設置集群名稱
17行
cluster.name: my-els
找到配置文件中的node.name按声,打開該配置并設置節(jié)點名稱
node.name: anolis8 //192.168.100.86
修改data存放的路徑
path.data: /data/es-data
修改logs日志的路徑
path.logs: /var/log/elasticsearch
鎖定物理內存地址,防止elasticsearch內存被交換出去,也就是避免es使用swap交換分區(qū)湃鹊,頻繁的交換儒喊,會導致IOPS變高;
bootstrap.memory_lock: true
監(jiān)聽的網絡地址
network.host: 0.0.0.0
開啟監(jiān)聽的端口
http.port: 9200
增加新的參數(shù)币呵,這樣head插件可以訪問es
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.system_call_filter: false
集群發(fā)現(xiàn)
在啟動此節(jié)點時怀愧,傳遞要執(zhí)行發(fā)現(xiàn)的主機的初始列表:
discovery.seed_hosts: ["192.168.100.86"]
初始用來引導集群的符合主節(jié)點條件的節(jié)點列表:
cluster.initial_master_nodes: ["192.168.100.86"]
保存退出
ps -ef|grep java
[root@anolis8 ~]# ps -ef|grep java
elastic+ 4234 1 1 11:40 ? 00:03:46 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -XX:+ShowCodeDetailsInExceptionMessages -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dio.netty.allocator.numDirectArenas=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j2.formatMsgNoLookups=true -Djava.locale.providers=SPI,COMPAT --add-opens=java.base/java.io=ALL-UNNAMED -Xms512m -Xmx512m -XX:+UseG1GC -Djava.io.tmpdir=/tmp/elasticsearch-18154957694075136409 -XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=/var/lib/elasticsearch -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log -Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m -XX:MaxDirectMemorySize=268435456 -XX:G1HeapRegionSize=4m -XX:InitiatingHeapOccupancyPercent=30 -XX:G1ReservePercent=15 -Des.path.home=/usr/share/elasticsearch -Des.path.conf=/etc/elasticsearch -Des.distribution.flavor=default -Des.distribution.type=rpm -Des.bundled_jdk=true -cp /usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -p /var/run/elasticsearch/elasticsearch.pid --quiet
可以看到elasticsearch啟動所使用的java路徑:/usr/share/elasticsearch/jdk/bin/java
查看java版本
[root@es01 home]# /usr/share/elasticsearch/jdk/bin/java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12)
OpenJDK 64-Bit Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode, sharing)
elasticsearch使用的內存大小為2G侨颈,我們把它改小點:
修改參數(shù):
vim /etc/elasticsearch/jvm.options
-Xms512m
-Xmx512m
啟動
systemctl start elasticsearch.service
**查看狀態(tài)**
[root@anolis8 ~]# systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2023-02-10 11:41:10 CST; 4h 51min ago
Docs: https://www.elastic.co
Main PID: 4234 (java)
Tasks: 69 (limit: 24888)
Memory: 934.4M
CGroup: /system.slice/elasticsearch.service
├─4234 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m >
└─4439 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
2月 10 11:40:33 anolis8 systemd[1]: Starting Elasticsearch...
2月 10 11:41:10 anolis8 systemd[1]: Started Elasticsearch.
lines 1-13/13 (END)
日志位置(日志的名稱是以集群名稱命名的):
[root@anolis8 ~]# ll /var/log/elasticsearch/
總用量 252
-rw-r--r-- 1 elasticsearch elasticsearch 163044 2月 10 16:32 gc.log
-rw-r--r-- 1 elasticsearch elasticsearch 2012 2月 10 11:40 gc.log.00
-rw-r--r-- 1 elasticsearch elasticsearch 0 2月 10 11:40 my-els_audit.json
-rw-r--r-- 1 elasticsearch elasticsearch 1278 2月 10 11:41 my-els_deprecation.json
-rw-r--r-- 1 elasticsearch elasticsearch 806 2月 10 11:41 my-els_deprecation.log
-rw-r--r-- 1 elasticsearch elasticsearch 0 2月 10 11:40 my-els_index_indexing_slowlog.json
-rw-r--r-- 1 elasticsearch elasticsearch 0 2月 10 11:40 my-els_index_indexing_slowlog.log
-rw-r--r-- 1 elasticsearch elasticsearch 0 2月 10 11:40 my-els_index_search_slowlog.json
-rw-r--r-- 1 elasticsearch elasticsearch 0 2月 10 11:40 my-els_index_search_slowlog.log
-rw-r--r-- 1 elasticsearch elasticsearch 28043 2月 10 11:41 my-els.log
-rw-r--r-- 1 elasticsearch elasticsearch 52811 2月 10 11:41 my-els_server.json
創(chuàng)建開機自啟動服務
systemctl enable elasticsearch.service
chkconfig elasticsearch on
如果報錯:
[2022-04-14T17:13:04,076][WARN ][o.e.b.JNANatives ] [es02] Unable to lock JVM Memory: error=12, reason=無法分配內存
[2022-04-14T17:13:04,078][WARN ][o.e.b.JNANatives ] [es02] This can result in part of the JVM being swapped out.
[2022-04-14T17:13:04,078][WARN ][o.e.b.JNANatives ] [es02] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536
[2022-04-14T17:13:04,079][WARN ][o.e.b.JNANatives ] [es02] These can be adjusted by modifying /etc/security/limits.conf, for example:
# allow user 'elasticsearch' mlockall
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
[2022-04-14T17:13:04,079][WARN ][o.e.b.JNANatives ] [es02] If you are logged in interactively, you will have to re-login for the new limits to take effect.
請修改/usr/lib/systemd/system/elasticsearch.service
vim /usr/lib/systemd/system/elasticsearch.service
[service]增加 LimitMEMLOCK=infinity
systemctl daemon-reload
systemctl restart elasticsearch.service
# netstat -antp |grep 9200
tcp6 0 0 :::9200 :::* LISTEN 25475/java
通過瀏覽器請求下9200的端口,看下是否成功, 以下為正常:
[root@anolis8 ~]# curl http://127.0.0.1:9200/
{
"name" : "anolis8 //192.168.100.86",
"cluster_name" : "my-els",
"cluster_uuid" : "g4amx5QxSq6-Wdf9y81iiQ",
"version" : {
"number" : "7.16.2",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "2b937c44140b6559905130a8650c64dbd0879cfb",
"build_date" : "2021-12-18T19:42:46.604893745Z",
"build_snapshot" : false,
"lucene_version" : "8.10.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
如何和elasticsearch交互
curl -i -XGET 'localhost:9200/_count?pretty'
HTTP/1.1 200 OK
X-elastic-product: Elasticsearch
Warning: 299 Elasticsearch-7.16.2-2b937c44140b6559905130a8650c64dbd0879cfb "Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.16/security-minimal-setup.html to enable security."
content-type: application/json; charset=UTF-8
content-length: 115
{
"count" : 10,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
}
}
3芯义、安裝elasticsearch-head插件
通過github下載elasticsearch-head項目
npm安裝 下載源碼哈垢,編譯安裝,在nodejs環(huán)境下運行插件
# yum install git bzip2 -y
下載地址:
https://github.com/mobz/elasticsearch-head
https://codeload.github.com/mobz/elasticsearch-head/tar.gz/refs/tags/v5.0.0
通過瀏覽器下載elasticsearch-head-5.0.0.tar.gz然后上傳后解壓
tar -zxvf elasticsearch-head-5.0.0.tar.gz
ll
-rw-r--r-- 1 root root 343758474 4月 9 17:31 elasticsearch-7.16.2-x86_64.rpm
drwxrwxr-x 7 root root 4096 4月 14 18:10 elasticsearch-head-5.0.0
-rw-r--r-- 1 root root 863489 4月 14 17:41 elasticsearch-head-5.0.0.tar.gz
dnf安裝nodejs
查看可用流的列表
[root@anolis8 elasticsearch-head-5.0.0]# dnf module list nodejs
Repository epel is listed more than once in the configuration
上次元數(shù)據(jù)過期檢查:3:22:28 前扛拨,執(zhí)行于 2023年02月10日 星期五 11時46分36秒耘分。
AnolisOS-8 - AppStream
Name Stream Profiles Summary
nodejs 10 [d][e] common [d], development, minimal, s2i Javascript runtime
nodejs 12 common [d], development, minimal, s2i Javascript runtime
nodejs 14 common [d], development, minimal, s2i Javascript runtime
nodejs 16 common [d], development, minimal, s2i Javascript runtime
Extra Packages for Enterprise Linux Modular 8 - x86_64
Name Stream Profiles Summary
nodejs 13 default, development, minimal Javascript runtime
nodejs 16-epel default, development, minimal Javascript runtime
提示:[d]默認,[e]已啟用绑警,[x]已禁用求泰,[i]已安裝
需要nodejs的版本在14以上才行。因此需要使用nodejs:16的流计盒。
[root@anolis8 elasticsearch-head-5.0.0]# dnf module install nodejs:16
Repository epel is listed more than once in the configuration
上次元數(shù)據(jù)過期檢查:3:23:16 前渴频,執(zhí)行于 2023年02月10日 星期五 11時46分36秒。
依賴關系解決北启。
這個操作會把模塊 'nodejs' 從流 '10' 切換到流 '16'
錯誤:無法切換已啟用模塊的流卜朗,除非顯式的通過配置選項 module_stream_switch 啟用。
推薦直接移除來自模塊的所有已安裝內容咕村,然后通過 'dnf module reset <module_name>' 命令重置模塊场钉。在您重置模塊之后,就可以安裝其他的流懈涛。
[root@anolis8 elasticsearch-head-5.0.0]# dnf module reset nodejs:16
Repository epel is listed more than once in the configuration
上次元數(shù)據(jù)過期檢查:3:25:23 前逛万,執(zhí)行于 2023年02月10日 星期五 11時46分36秒。
只需要模塊名肩钠。正在忽略'nodejs:16'中的無用信息
依賴關系解決泣港。
============================================================================================================================================================================
軟件包 架構 版本 倉庫 大小
============================================================================================================================================================================
重置模塊:
nodejs
事務概要
============================================================================================================================================================================
確定嗎?[y/N]: y
完畢价匠!
查看結果
[root@anolis8 elasticsearch-head-5.0.0]# dnf module list nodejs
Repository epel is listed more than once in the configuration
上次元數(shù)據(jù)過期檢查:3:25:55 前,執(zhí)行于 2023年02月10日 星期五 11時46分36秒呛每。
AnolisOS-8 - AppStream
Name Stream Profiles Summary
nodejs 10 [d] common [d], development, minimal, s2i Javascript runtime
nodejs 12 common [d], development, minimal, s2i Javascript runtime
nodejs 14 common [d], development, minimal, s2i Javascript runtime
nodejs 16 common [d], development, minimal, s2i Javascript runtime
Extra Packages for Enterprise Linux Modular 8 - x86_64
Name Stream Profiles Summary
nodejs 13 default, development, minimal Javascript runtime
nodejs 16-epel default, development, minimal Javascript runtime
提示:[d]默認踩窖,[e]已啟用,[x]已禁用晨横,[i]已安裝
安裝nodejs16
[root@anolis8 elasticsearch-head-5.0.0]# dnf module install nodejs:16
Repository epel is listed more than once in the configuration
上次元數(shù)據(jù)過期檢查:3:26:24 前洋腮,執(zhí)行于 2023年02月10日 星期五 11時46分36秒。
依賴關系解決手形。
============================================================================================================================================================================
軟件包 架構 版本 倉庫 大小
============================================================================================================================================================================
安裝組/模塊包:
nodejs x86_64 1:16.17.1-1.module+an8.6.0+10852+70f84ff5 AppStream 12 M
npm x86_64 1:8.15.0-1.16.17.1.1.module+an8.6.0+10852+70f84ff5 AppStream 1.9 M
安裝弱的依賴:
nodejs-docs noarch 1:16.17.1-1.module+an8.6.0+10852+70f84ff5 AppStream 9.3 M
nodejs-full-i18n x86_64 1:16.17.1-1.module+an8.6.0+10852+70f84ff5 AppStream 8.0 M
安裝模塊配置檔案:
nodejs/common
啟用模塊流:
nodejs 16
事務概要
============================================================================================================================================================================
安裝 4 軟件包
總下載:31 M
安裝大猩豆:153 M
確定嗎?[y/N]:
檢查結果
[root@anolis8 elasticsearch-head-5.0.0]# node -v
v16.17.1
[root@anolis8 elasticsearch-head-5.0.0]# npm -v
8.15.0
cd elasticsearch-head-5.0.0/
ll
總用量 96
-rw-rw-r-- 1 root root 248 9月 15 2017 Dockerfile
-rw-rw-r-- 1 root root 221 9月 15 2017 Dockerfile-alpine
-rw-rw-r-- 1 root root 104 9月 15 2017 elasticsearch-head.sublime-project
-rw-rw-r-- 1 root root 2171 9月 15 2017 Gruntfile.js
-rw-rw-r-- 1 root root 3482 9月 15 2017 grunt_fileSets.js
-rw-rw-r-- 1 root root 1088 9月 15 2017 index.html
-rw-rw-r-- 1 root root 559 9月 15 2017 LICENCE
drwxr-xr-x 461 root root 32768 4月 14 18:03 node_modules
-rw------- 1 root root 192 4月 14 18:10 nohup.out
-rw-rw-r-- 1 root root 886 9月 15 2017 package.json
-rw-rw-r-- 1 root root 100 9月 15 2017 plugin-descriptor.properties
drwxrwxr-x 4 root root 53 9月 15 2017 proxy
-rw-rw-r-- 1 root root 6944 9月 15 2017 README.textile
drwxrwxr-x 5 root root 140 9月 15 2017 _site
drwxrwxr-x 4 root root 31 9月 15 2017 src
drwxrwxr-x 4 root root 70 9月 15 2017 test
通過阿里巴巴源安裝cnpm
[root@anolis8 elasticsearch-head-5.0.0]# npm install -g cnpm --registry=https://registry.npm.taobao.org
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
added 38 packages, removed 76 packages, and changed 380 packages in 19s
11 packages are looking for funding
run `npm fund` for details
npm notice
npm notice New major version of npm available! 8.15.0 -> 9.4.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.4.2
npm notice Run npm install -g npm@9.4.2 to update!
npm notice
---------------------------
[root@anolis8 elasticsearch-head-5.0.0]# cnpm install
? [2/10] Installing qs@~5.1.0
WARN node unsupported "node@v16.17.1" is incompatible with karma@1.3.0, expected node@0.10 || 0.12 || 4 || 5 || 6
? [2/10] Installing path-is-absolute@^1.0.0
WARN node unsupported "node@v16.17.1" is incompatible with grunt-contrib-connect@1.0.2 ? http2@^3.3.4, expected node@>=0.12.0 <9.0.0
? Installed 10 packages on /root/elasticsearch-head-5.0.0
? Linked 383 latest versions fallback to /root/elasticsearch-head-5.0.0/node_modules/.store/node_modules
[1/2] scripts.install grunt-contrib-jasmine@1.0.3 ? grunt-lib-phantomjs@1.1.0 ? phantomjs-prebuilt@^2.1.3 run "node install.js", root: "/root/elasticsearch-head-5.0.0/node_modules/.store/phantomjs-prebuilt@2.1.16/node_modules/phantomjs-prebuilt"
PhantomJS not found on PATH
Downloading https://cdn.npmmirror.com/binaries/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...
[=================================-------] 82%
Received 22866K total.
Extracting tar contents (via spawned process)
Removing /root/elasticsearch-head-5.0.0/node_modules/.store/phantomjs-prebuilt@2.1.16/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1676013537803/phantomjs-2.1.1-linux-x86_64 -> /root/elasticsearch-head-5.0.0/node_modules/.store/phantomjs-prebuilt@2.1.16/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /root/elasticsearch-head-5.0.0/node_modules/.store/phantomjs-prebuilt@2.1.16/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
[1/2] scripts.install grunt-contrib-jasmine@1.0.3 ? grunt-lib-phantomjs@1.1.0 ? phantomjs-prebuilt@^2.1.3 finished in 10s
[2/2] scripts.postinstall karma@1.3.0 ? core-js@^2.2.0 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "/root/elasticsearch-head-5.0.0/node_modules/.store/core-js@2.6.12/node_modules/core-js"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
[2/2] scripts.postinstall karma@1.3.0 ? core-js@^2.2.0 finished in 123ms
? Run 2 scripts
deprecate grunt-contrib-connect@1.0.2 ? http2@^3.3.4 Use the built-in module in node 9.0.0 or newer, instead
deprecate grunt@1.0.1 ? coffee-script@~1.10.0 CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
deprecate grunt-contrib-jasmine@1.0.3 ? grunt-lib-phantomjs@1.1.0 ? phantomjs-prebuilt@^2.1.3 this package is now deprecated
deprecate karma@1.3.0 ? chokidar@^1.4.1 Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
anti semver karma@1.3.0 ? useragent@2.3.0 ? tmp@0.0.x delcares tmp@0.0.x(resolved as 0.0.33) but using ancestor(karma)'s dependency tmp@0.0.28(resolved as 0.0.28)
deprecate grunt-contrib-jasmine@1.0.3 ? grunt-lib-phantomjs@1.1.0 ? phantomjs-prebuilt@2.1.16 ? request@^2.81.0 request has been deprecated, see https://github.com/request/request/issues/3142
deprecate karma@1.3.0 ? log4js@^0.6.31 0.x is no longer supported. Please upgrade to 6.x or higher.
deprecate grunt-contrib-jasmine@1.0.3 ? grunt-lib-phantomjs@1.1.0 ? phantomjs-prebuilt@2.1.16 ? request@2.88.2 ? har-validator@~5.1.3 this library is no longer supported
deprecate karma@1.3.0 ? socket.io@1.4.7 ? socket.io-parser@2.2.6 ? json3@3.3.2 Please use the native JSON object instead of JSON 3
deprecate grunt-contrib-jasmine@1.0.3 ? grunt-lib-phantomjs@1.1.0 ? phantomjs-prebuilt@2.1.16 ? request@2.88.2 ? uuid@^3.3.2 Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
deprecate karma@1.3.0 ? socket.io@1.4.7 ? socket.io-adapter@0.4.0 ? socket.io-parser@2.2.2 ? json3@3.2.6 Please use the native JSON object instead of JSON 3
deprecate karma@1.3.0 ? chokidar@1.7.0 ? readdirp@2.2.1 ? micromatch@3.1.10 ? snapdragon@0.8.2 ? source-map-resolve@^0.5.0 See https://github.com/lydell/source-map-resolve#deprecated
deprecate karma@1.3.0 ? chokidar@1.7.0 ? readdirp@2.2.1 ? micromatch@3.1.10 ? snapdragon@0.8.2 ? source-map-resolve@0.5.3 ? source-map-url@^0.4.0 See https://github.com/lydell/source-map-url#deprecated
deprecate karma@1.3.0 ? chokidar@1.7.0 ? readdirp@2.2.1 ? micromatch@3.1.10 ? snapdragon@0.8.2 ? source-map-resolve@0.5.3 ? urix@^0.1.0 Please see https://github.com/lydell/urix#deprecated
deprecate karma@1.3.0 ? chokidar@1.7.0 ? readdirp@2.2.1 ? micromatch@3.1.10 ? snapdragon@0.8.2 ? source-map-resolve@0.5.3 ? resolve-url@^0.2.1 https://github.com/lydell/resolve-url#deprecated
deprecate karma@1.3.0 ? core-js@^2.2.0 core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
Recently updated (since 2023-02-03): 2 packages (detail see file /root/elasticsearch-head-5.0.0/node_modules/.recently_updates.txt)
Today:
→ grunt@1.0.1 ? dateformat@1.0.12 ? meow@3.7.0 ? minimist@^1.1.3(1.2.8) (04:59:49)
? All packages installed (458 packages installed from npm registry, used 21s(network 11s), speed 769.13KB/s, json 384(1.78MB), tarball 6.41MB, manifests cache hit 0, etag hit 0 / miss 0)
啟動es-head插件,必須進入es-head插件目錄運行啟動命令
cd elasticsearch-head-5.0.0/
[root@anolis8 elasticsearch-head-5.0.0]# nohup npm run start &
使用瀏覽器訪問http://192.168.100.86:9100/即可訪問到es-head插件库糠,再使用es-head插件訪問es數(shù)據(jù)庫伙狐,效果如下
http://192.168.100.86:9200/
注意
9100端口是插件端口涮毫,9200是es端口
通過插件訪問http://192.168.100.86:9200點擊連接還是失敗,是因為es有安全機制只允許服務器本地訪問贷屎,這時需要設置
設置跨域:
設置跨域同時也適用于安裝的es-head插件跟es數(shù)據(jù)不在同一臺服務器上時的情況
#編輯es主配置文件罢防,在文本末尾添加如下兩行配置
vim /etc/elasticsearch/elasticsearch.yml
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"
systemctl restart elasticsearch
cd elasticsearch-head-5.0.0/
nohup npm run start &
注意 :別把es-head插件后放到 Elasticsearch的plugins目錄下,否則會報錯!!!
三唉侄、安裝本地Elasticsearch的IK分詞插件和拼音分詞插件
1咒吐、 安裝本地Elasticsearch的IK分詞插件
Ik-Analysis: elasticsearch-analysis-ik-7.16.2
下載地址:https://github.com/medcl/elasticsearch-analysis-ik/releases
解壓下載文件elasticsearch-analysis-ik-7.16.2.zip
ll elasticsearch-analysis-ik-7.16.2
總用量 1428
-rw-r--r-- 1 root root 263965 4月 15 16:59 commons-codec-1.9.jar
-rw-r--r-- 1 root root 61829 4月 15 16:59 commons-logging-1.2.jar
drwxr-xr-x 2 root root 299 4月 15 16:59 config
-rw-r--r-- 1 root root 54595 4月 15 16:59 elasticsearch-analysis-ik-7.16.2.jar
-rw-r--r-- 1 root root 736658 4月 15 16:59 httpclient-4.5.2.jar
-rw-r--r-- 1 root root 326724 4月 15 16:59 httpcore-4.4.4.jar
-rw-r--r-- 1 root root 1807 4月 15 16:59 plugin-descriptor.properties
-rw-r--r-- 1 root root 125 4月 15 16:59 plugin-security.policy
將解壓后的elasticsearch-analysis-ik-7.16.2 文件夾上傳至elasticsearch安裝目錄下的plugins下
/usr/share/elasticsearch/plugins/
重啟Elasticsearch,可以看到控制臺打印日志
loaded plugin [analysis-ik]
2属划、 安裝本地Elasticsearch的拼音分詞插件
analysis-pinyin: elasticsearch-analysis-pinyin-7.16.2
下載地址:https://github.com/medcl/elasticsearch-analysis-pinyin/releases
上傳下載文件elasticsearch-analysis-pinyin-7.16.2.zip
ll elasticsearch-analysis-pinyin-7.16.2
總用量 7936
-rw-r--r-- 1 root root 27445 4月 15 16:59 elasticsearch-analysis-pinyin-7.16.2.jar
-rw-r--r-- 1 root root 8091448 4月 15 16:59 nlp-lang-1.7.jar
-rw-r--r-- 1 root root 1824 4月 15 16:59 plugin-descriptor.properties
將解壓后的elasticsearch-analysis-pinyin-7.16.2 文件夾上傳至elasticsearch安裝目錄下的plugins下
/usr/share/elasticsearch/plugins/
重啟Elasticsearch恬叹,可以看到控制臺打印日志
loaded plugin [analysis-pinyin]
nodejs下載地址
https://nodejs.org/zh-cn/download/
es官網的安裝方式
https://www.elastic.co/guide/en/elasticsearch/reference/8.6/rpm.html#rpm-repo