centos7 安装 elastic search 2.3.2

编程入门 行业动态 更新时间:2024-10-07 04:36:15

centos7 安装    <a href=https://www.elefans.com/category/jswz/34/1771232.html style=elastic search 2.3.2"/>

centos7 安装 elastic search 2.3.2

先 安装JDK

我这已安装

[root@iZ258cho4sfZ home]# java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)


创建专属用户 essearch

useradd essearch


下载 elasticsearch

.3.2/elasticsearch-2.3.2.zip

解压

cd /usr/local

unzip /home/soft/elasticsearch-2.3.2.zip -d ./

修改所有者

chown -R essearch elasticsearch-2.3.2/

启动

进到bin目录

su essearch

./elasticsearch -d   后台方式启动

查看启动日志

tail -100f elasticsearch.log

[2016-04-28 13:33:42,866][INFO ][node                     ] [Captain Atlas] version[2.3.2], pid[2506], build[b9e4a6a/2016-04-21T16:03:47Z]
[2016-04-28 13:33:42,867][INFO ][node                     ] [Captain Atlas] initializing ...
[2016-04-28 13:33:43,805][INFO ][plugins                  ] [Captain Atlas] modules [reindex, lang-expression, lang-groovy], plugins [], sites []
[2016-04-28 13:33:43,838][INFO ][env                      ] [Captain Atlas] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [34.3gb], net total_space [39.2gb], spins? [unknown], types [rootfs]
[2016-04-28 13:33:43,838][INFO ][env                      ] [Captain Atlas] heap size [1015.6mb], compressed ordinary object pointers [true]
[2016-04-28 13:33:43,838][WARN ][env                      ] [Captain Atlas] max file descriptors [65535] for elasticsearch process likely too low, consider increasing to at least [65536]
[2016-04-28 13:33:47,077][INFO ][node                     ] [Captain Atlas] initialized
[2016-04-28 13:33:47,078][INFO ][node                     ] [Captain Atlas] starting ...
[2016-04-28 13:33:47,202][INFO ][transport                ] [Captain Atlas] publish_address {101.200.194.213:9300}, bound_addresses {0.0.0.0:9300}
[2016-04-28 13:33:47,215][INFO ][discovery                ] [Captain Atlas] elasticsearch/kIYwRG-qRJ66PAxK23HdxQ
[2016-04-28 13:33:50,296][INFO ][cluster.service          ] [Captain Atlas] new_master {Captain Atlas}{kIYwRG-qRJ66PAxK23HdxQ}{101.200.194.213}{101.200.194.213:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2016-04-28 13:33:50,336][INFO ][http                     ] [Captain Atlas] publish_address {101.200.194.213:9200}, bound_addresses {0.0.0.0:9200}
[2016-04-28 13:33:50,336][INFO ][node                     ] [Captain Atlas] started
[2016-04-28 13:33:50,371][INFO ][gateway                  ] [Captain Atlas] recovered [0] indices into cluster_state

访问

用localhost、127.0.0.1都能够连接成功,但是其他机器不能访问

修改

network.host: 0.0.0.0

或者是你客户端的ip

http://101.200.194.213:9200/

{"name" : "Wild Child","cluster_name" : "elasticsearch","version" : {"number" : "2.3.2","build_hash" : "b9e4a6acad4008027e4038f6abed7f7dba346f94","build_timestamp" : "2016-04-21T16:03:47Z","build_snapshot" : false,"lucene_version" : "5.5.0"},"tagline" : "You Know, for Search"

进到elasticsearch  的  bin

[essearch@iZ258cho4sfZ bin]$ ./plugin install mobz/elasticsearch-head
-> Installing mobz/elasticsearch-head...
Trying .zip ...
Downloading ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Verifying .zip checksums if available ...
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
Installed head into /usr/local/elasticsearch-2.3.2/plugins/head

成功

head插件访问

http://101.200.194.213:9200/_plugin/head/


    如图就可以看出,该插件可以对数据进行任何增删改查,所以不建议在正式环境中使用它,如果使用,也必须限制规定的IP能够使用。


更改分词器  IK

.zip

下载解压后导入eclipse


编译发布后,在打开编译后的target\releases,解压压缩包,然后进入解压的压缩包里面可以看到几个jar包和配置文件。


在Elasticsearch的安装的plugin下创建文件夹ik

将上面所说的文件拷贝到ik文件夹下。

重启elasticsearch

启动时可能出现如下错误,这是因为我的elasticsearch用的是2.3.2, 而IK分词当前最新是支持到2.3.1

[2016-04-28 14:26:14,229][INFO ][node                     ] [Lurking Unknown] initializing ...
Exception in thread "main" java.lang.IllegalArgumentException: Plugin [analysis-ik] is incompatible with Elasticsearch [2.3.2]. Was designed for version [2.3.1]
        at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:118)
        at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:378)

为了规避这个错误,我修改了配置文件plugin-descriptor.properties

将elasticsearch.version=2.3.1改为elasticsearch.version=2.3.2.  重启正常了,不知是否有问题,以后有新版本在换成对应的。

用新的分词器访问

http://101.200.194.213:9200/_analyze?analyzer=ik&pretty=true&text=helloworld,%E6%AC%A2%E8%BF%8E%E6%82%A8

{"tokens" : [ {"token" : "helloworld","start_offset" : 0,"end_offset" : 10,"type" : "ENGLISH","position" : 0}, {"token" : "欢迎您","start_offset" : 11,"end_offset" : 14,"type" : "CN_WORD","position" : 1}, {"token" : "欢迎","start_offset" : 11,"end_offset" : 13,"type" : "CN_WORD","position" : 2}, {"token" : "您","start_offset" : 13,"end_offset" : 14,"type" : "CN_CHAR","position" : 3} ]
}
已成功使用IK。




更多推荐

centos7 安装 elastic search 2.3.2

本文发布于:2024-02-27 18:13:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1765575.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:elastic   search

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!