centos7 安装 elastic search 2.3.2

来源:互联网 发布:淘宝如何开通淘金币 编辑:程序博客网 时间:2024/05/18 00:04

先 安装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

https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/2.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 https://github.com/mobz/elasticsearch-head/archive/master.zip ...
Downloading ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Verifying https://github.com/mobz/elasticsearch-head/archive/master.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

https://github.com/medcl/elasticsearch-analysis-ik/archive/master.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。




0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 做完卷腹脖子疼怎么办 医疗设备销售遭遇瓶颈怎么办 给顾客加油加超了怎么办 卡密码输错两次怎么办 擤鼻涕耳朵会响怎么办 鼻子里有血丝是怎么办 怀孕8周上火了怎么办 鼻炎犯了鼻涕流不停怎么办 擤鼻涕眼睛肿了怎么办 感冒咳嗽鼻子不通气怎么办 宝宝感冒不会擤鼻涕怎么办 新生儿鼻腔里有鼻涕怎么办 宝宝鼻腔有鼻涕出不来怎么办 怀孕的人感冒了怎么办 孕37周感冒咳嗽怎么办 吹鼻涕耳朵堵了怎么办 怀孕的孔雀鱼生病了怎么办 生病了咳嗽一直不好怎么办 宝宝生病治疗后咳嗽怎么办 2个月宝宝老是生病怎么办 2个月的哈士奇生病怎么办 怀孕的猫生病了怎么办 宝宝生病咳嗽啥都不吃怎么办 怀孕了感冒了怎么办啊 2个月宝宝生病了怎么办 刚刚怀孕了就生病了怎么办 一岁多宝宝总是发烧咳嗽生病怎么办 7个月宝宝生病怎么办 4个月宝宝老是生病怎么办 孕早期嗓子有痰怎么办 鼻炎早晨起床鼻涕带血怎么办 鼻子破皮了结痂怎么办 擤鼻子耳朵好像堵住了怎么办 鼻子和脸上起皮怎么办 鼻子擦鼻涕擦红怎么办 鼻子下面擦红了怎么办 鼻子擤鼻涕破皮怎么办 哭完鼻子不通气怎么办 擦鼻子擦多了疼怎么办 擤鼻涕时耳朵听不见了怎么办 吸鼻涕耳朵感觉被塞怎么办