升级安装elastcsearch
发表于:2025-01-26 作者:千家信息网编辑
千家信息网最后更新 2025年01月26日,公司之前的elasticsearch版本为1.7版本,由于体验更多的特性,需要把1.7版本升级到最新版本2.2.1查看java版本,官方推荐最低为1.7[root@dev lib64]# java -
千家信息网最后更新 2025年01月26日升级安装elastcsearch
公司之前的elasticsearch版本为1.7版本,由于体验更多的特性,需要把1.7版本升级到最新版本2.2.1
查看java版本,官方推荐最低为1.7[root@dev lib64]# java -versionjava version "1.8.0_31"Java(TM) SE Runtime Environment (build 1.8.0_31-b13)Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)下载ela 2.2.1版本的rpm包,并进行安装[root@dev tmp]# yum localinstall elasticsearch-2.2.1.rpm Loaded plugins: fastestmirrorRepodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fastExamining elasticsearch-2.2.1.rpm: elasticsearch-2.2.1-1.noarchMarking elasticsearch-2.2.1.rpm as an update to elasticsearch-1.7.4-1.noarchResolving Dependencies--> Running transaction check---> Package elasticsearch.noarch 0:1.7.4-1 will be updated---> Package elasticsearch.noarch 0:2.2.1-1 will be an update--> Finished Dependency ResolutionDependencies Resolved============================================================================= Package Arch Version Repository Size=============================================================================Updating: elasticsearch noarch 2.2.1-1 /elasticsearch-2.2.1 31 MTransaction Summary=============================================================================Upgrade 1 PackageTotal size: 31 MIs this ok [y/d/N]: yDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction Updating : elasticsearch-2.2.1-1.noarch 1/2 warning: /etc/elasticsearch/elasticsearch.yml created as /etc/elasticsearch/elasticsearch.yml.rpmnewwarning: /etc/sysconfig/elasticsearch created as /etc/sysconfig/elasticsearch.rpmnew Cleanup : elasticsearch-1.7.4-1.noarch 2/2 warning: file /tmp/elasticsearch: remove failed: No such file or directory Verifying : elasticsearch-2.2.1-1.noarch 1/2 Verifying : elasticsearch-1.7.4-1.noarch 2/2 Updated: elasticsearch.noarch 0:2.2.1-1 Complete!尝试启动服务[root@dev tmp]# /etc/init.d/elasticsearch startStarting elasticsearch (via systemctl): Warning: elasticsearch.service changed on disk. Run 'systemctl daemon-reload' to reload units. [ OK ][root@dev tmp]# /etc/init.d/elasticsearch statusCONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed.[root@dev tmp]# /etc/init.d/elasticsearch status● elasticsearch.service - Elasticsearch Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2016-03-29 06:18:15 EDT; 4min 7s ago Docs: http://www.elastic.co Process: 3301 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -Des.pidfile=${PID_DIR}/elasticsearch.pid -Des.default.path.home=${ES_HOME} -Des.default.path.logs=${LOG_DIR} -Des.default.path.data=${DATA_DIR} -Des.default.path.conf=${CONF_DIR} (code=exited, status=1/FAILURE) Process: 3299 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS) Main PID: 3301 (code=exited, status=1/FAILURE)Mar 29 06:18:15 dev.wware.org elasticsearch[3301]: at org.elasticsearch.node.Node.(Node.java:153)Mar 29 06:18:15 dev.wware.org elasticsearch[3301]: at org.elasticsearch.node.Node. (Node.java:128)Mar 29 06:18:15 dev.wware.org elasticsearch[3301]: at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)Mar 29 06:18:15 dev.wware.org elasticsearch[3301]: at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)Mar 29 06:18:15 dev.wware.org elasticsearch[3301]: at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)Mar 29 06:18:15 dev.wware.org elasticsearch[3301]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)Mar 29 06:18:15 dev.wware.org elasticsearch[3301]: Refer to the log for complete error details.Mar 29 06:18:15 dev.wware.org systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILUREMar 29 06:18:15 dev.wware.org systemd[1]: Unit elasticsearch.service entered failed state.Mar 29 06:18:15 dev.wware.org systemd[1]: elasticsearch.service failed.[root@dev tmp]# 查看log[2016-03-29 06:24:44,501][INFO ][node ] [Snowfall] version[2.2.1], pid[3583], build[d045fc2/2016-03-09T09:38:54Z][2016-03-29 06:24:44,502][INFO ][node ] [Snowfall] initializing ...[2016-03-29 06:24:45,225][INFO ][plugins ] [Snowfall] modules [lang-expression, lang-groovy], plugins [], sites [][2016-03-29 06:24:45,249][ERROR][bootstrap ] Exceptionjava.lang.IllegalStateException: Failed to created node environment at org.elasticsearch.node.Node. (Node.java:155) at org.elasticsearch.node.Node. (Node.java:128) at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)Caused by: java.nio.file.AccessDeniedException: /var/lib/elasticsearch/elasticsearch/nodes/1 at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) at java.nio.file.Files.createDirectory(Files.java:674) at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) at java.nio.file.Files.createDirectories(Files.java:767) at org.elasticsearch.env.NodeEnvironment. (NodeEnvironment.java:169) at org.elasticsearch.node.Node. (Node.java:153) ... 5 more
看来升级安装后,服务会起不来,是node环境的问题,把之前的文件全部删掉,全新安装
[root@dev lib64]# find / -name "elasticsearch" -exec rm -rf {} \;
再次安装
[root@dev tmp]# yum localinstall elasticsearch-2.2.1.rpm Loaded plugins: fastestmirrorRepodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fastExamining elasticsearch-2.2.1.rpm: elasticsearch-2.2.1-1.noarchMarking elasticsearch-2.2.1.rpm to be installedResolving Dependencies--> Running transaction check---> Package elasticsearch.noarch 0:2.2.1-1 will be installed--> Finished Dependency ResolutionDependencies Resolved============================================================================= Package Arch Version Repository Size=============================================================================Installing: elasticsearch noarch 2.2.1-1 /elasticsearch-2.2.1 31 MTransaction Summary=============================================================================Install 1 PackageTotal size: 31 MInstalled size: 31 MIs this ok [y/d/N]: yDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transactionCreating elasticsearch group... OKCreating elasticsearch user... OK Installing : elasticsearch-2.2.1-1.noarch 1/1 ### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd sudo systemctl daemon-reload sudo systemctl enable elasticsearch.service### You can start elasticsearch service by executing sudo systemctl start elasticsearch.service Verifying : elasticsearch-2.2.1-1.noarch 1/1 Installed: elasticsearch.noarch 0:2.2.1-1 Complete![root@dev tmp]# sudo systemctl daemon-reload[root@dev tmp]# sudo systemctl enable elasticsearch.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/elasticsearch.service to /usr/lib/systemd/system/elasticsearch.service.[root@dev tmp]# sudo systemctl start elasticsearch.service[root@dev tmp]# sudo systemctl status elasticsearch.service● elasticsearch.service - Elasticsearch Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2016-03-29 06:35:17 EDT; 5s ago Docs: http://www.elastic.co Process: 3992 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS) Main PID: 3994 (java) CGroup: /system.slice/elasticsearch.service └─3994 /bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+...Mar 29 06:35:18 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:18,91...Mar 29 06:35:18 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:18,91...Mar 29 06:35:19 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:19,65...Mar 29 06:35:19 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:19,68...Mar 29 06:35:19 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:19,68...Mar 29 06:35:19 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:19,68...Mar 29 06:35:22 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:22,70...Mar 29 06:35:22 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:22,70...Mar 29 06:35:22 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:22,90...Mar 29 06:35:22 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:22,94...Hint: Some lines were ellipsized, use -l to show in full.[root@dev tmp]# sudo systemctl status elasticsearch.service● elasticsearch.service - Elasticsearch Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2016-03-29 06:35:17 EDT; 6s ago Docs: http://www.elastic.co Process: 3992 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS) Main PID: 3994 (java) CGroup: /system.slice/elasticsearch.service └─3994 /bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+...Mar 29 06:35:18 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:18,91...Mar 29 06:35:18 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:18,91...Mar 29 06:35:19 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:19,65...Mar 29 06:35:19 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:19,68...Mar 29 06:35:19 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:19,68...Mar 29 06:35:19 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:19,68...Mar 29 06:35:22 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:22,70...Mar 29 06:35:22 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:22,70...Mar 29 06:35:22 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:22,90...Mar 29 06:35:22 dev.wware.org elasticsearch[3994]: [2016-03-29 06:35:22,94...Hint: Some lines were ellipsized, use -l to show in full.
查看端口
[root@dev tmp]# lsof -i:9200COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEjava 3994 elasticsearch 112u IPv6 54287 0t0 TCP localhost:wap-wsp (LISTEN)java 3994 elasticsearch 113u IPv6 54288 0t0 TCP localhost:wap-wsp (LISTEN)
端口没监听在ipv4上。
comment:2
看来下官方文档, elasticsearch默认监听在localhost上,修改配置文件,把127.0.0.1改为本机ip
[root@dev elasticsearch]# vim elasticsearch.ymlnetwork.host: 10.0.2.15使用curl访问下[root@dev elasticsearch]# curl 10.0.2.15:9200{ "name" : "Bulldozer", "cluster_name" : "elasticsearch", "version" : { "number" : "2.2.1", "build_hash" : "d045fc29d1932bce18b2e65ab8b297fbf6cd41a1", "build_timestamp" : "2016-03-09T09:38:54Z", "build_snapshot" : false, "lucene_version" : "5.4.1" }, "tagline" : "You Know, for Search"}
使用浏览器访问
http://10.0.2.15:9200/{ "name" : "Bulldozer", "cluster_name" : "elasticsearch", "version" : { "number" : "2.2.1", "build_hash" : "d045fc29d1932bce18b2e65ab8b297fbf6cd41a1", "build_timestamp" : "2016-03-09T09:38:54Z", "build_snapshot" : false, "lucene_version" : "5.4.1" }, "tagline" : "You Know, for Search"}
公司需要安装analysis-smartcn和mapper-p_w_uploads
[root@dev elasticsearch]# find / -type f -name plugin/usr/share/elasticsearch/bin/plugin[root@dev elasticsearch]# /usr/share/elasticsearch/bin/plugin install analysis-smartcn-> Installing analysis-smartcn...Trying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/analysis-smartcn/2.2.1/analysis-smartcn-2.2.1.zip ...Downloading .............................................................................................................................................................................................................................DONEVerifying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/analysis-smartcn/2.2.1/analysis-smartcn-2.2.1.zip checksums if available ...Downloading .DONEroot@dev elasticsearch]# /usr/share/elasticsearch/bin/plugin install mapper-p_w_uploads-> Installing mapper-p_w_uploads...Trying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/mapper-p_w_uploads/2.2.1/mapper-p_w_uploads-2.2.1.zip ...Downloading ........................................................安装这两个插件时会被墙掉,可以自己先wget下来,然后使用/usr/share/elasticsearch/bin/plugin install +rurl指定安装包安装。如果需要使用http访问elasticsearch数据库,需要安装head,安装/usr/share/elasticsearch/bin/plugin install mobz/elasticsearch-head使用浏览器访问 10.0.2.15:9200/_plugin/head/可以看到数据。
版本
升级
公司
官方
数据
文件
浏览器
端口
服务
浏览
监听
最低
两个
全新
再次
插件
数据库
文档
更多
特性
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
王者荣耀新服务器
深信服 软件开发工程师
成图软件开发
云计算下计算机网络安全研究结论
商品销售数据库设计表
服务器怎么更换管理员密码
铜陵oa管理软件开发费用
网络安全上网手抄报简单
网络安全手抄报简单又没有字
SES视频软件开发
大微互联网物流科技
小商品软件开发
浙江大数据数显钟服务器云主机
三国战纪ps4 服务器
服务器占用cpu死机怎么办
临沂软件开发建设
广州为知互联网科技有限公
光遇switch是哪个服务器
沧州市有软件开发吗
英雄联盟服务器修复需要多久
网络安全支付怎么办
lumen 数据库连接
jdbc数据库需要jar吗
山西晋中java软件开发培训
技术强华为云云数据库销售
选择软件开发知乎
vue上传文件到oss服务器
未来软件开发方向
安康软件开发设计
网络安全隔离软件技术手段