Elasticsearch安装记录

浏览: 2821

Elasticsearch(ES)是一个基于 Lucene的开源搜索引擎,它不但稳定、可靠、快速,而且也具有良好的水平扩展能力,是专门为分布式环境设计的。如何下是两个节点集群安装流程:


1、前提条件,es运行需要非root用户负责会出现如下错误,以及需要安装jdk

 ./elasticsearch
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.

2、新建linux用户并修改用户权限:

/home/下查看已有用户,新建用户:

useradd root2
passwd root2
cdt_root123
vi etc/sudoers #在root下加入如下增加用户权限 

root2    ALL=(ALL)      ALL

 3、解压(Es是解压即可运行)

 tar -zxvf elasticsearch-2.4.0.tar.gz

 4、进入 /dwbi/elasticsearch-2.4.0/config/elasticsearch.yml

找到 cluster.name: myClusterEs修改集群名,修改结点名: node.name: myNodeEs

修改ip和端口:network.host: 192.168.1.1,http.port: 9200

进入/dwbi/elasticsearch-2.4.0/bin/elasticsearch.in.sh

找到ES_MIN_MEM和ES_MAX_MEM,修改es最大和最小占用内存值,512和2g

5、运行./elasticsearch 出现错误

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /dwbi/elasticsearch-2.4.0/logs/elasticsearch.log (权限不够)
........

解决方法:将 /dwbi/elasticsearch-2.4.0所属用户改为root2并赋予其执行权限:

 chmod -R 777 elasticsearch-2.4.0
sudo chown  root2 elasticsearch-2.4.0

因回忆写,好像加了下面的,把根据提示的错误修改了对应文件夹的权限和所属用户

sudo chown root2 bin
chmod -R 777 logs
sudo chown -R root2  elasticsearch-2.4.0

5、启动./elasticsearch

进入http://192.168.1.1:9200/

{
"name" : "myNodeEs",
"cluster_name" : "myClusterEs",
"version" : {
"number" : "2.4.0",
"build_hash" : "ce9f0c7394dee074091dd1bc4e9469251181fc55",
"build_timestamp" : "2016-08-29T09:14:17Z",
"build_snapshot" : false,
"lucene_version" : "5.5.2"
},
"tagline" : "You Know, for Search"
}

ok,成功

6、运用插件运行关闭es,下载插件elasticsearch-servicewrapper-master.zip

 解压: 

sudo unzip elasticsearch-servicewrapper-master.zip
 mv /dwbi/elasticsearch-servicewrapper-master/service /dwbi/elasticsearch-2.4.0/bin/service

7、启动es, 

cd  /dwbi/elasticsearch-2.4.0/bin/service
./elasticsearch start (后台运行,console 前台运行,stop停止)

8、安装elasticsearch的集群管理工具elasticsearch-head

建立文件夹/dwbi/elasticsearch-2.4.0/plugins/head/_site文件

解压

sudo  unzip elasticsearch-head-master.zip
cp -r elasticsearch-head-master/* /dwbi/elasticsearch-2.4.0/plugins/head/_site/

9、打开http://localhost:9200/_plugin/head/即可web访问

10、集群配置

按照相同方法安装,然后在elasticsearch.yml末尾加入如下信息即可

node.master: true
 node.data: true
 index.number_of_shards: 5
 index.number_of_replicas: 3
 network.bind_host: 0.0.0.0
 network.publish_host: 192.168.1.1
 transport.tcp.port: 9300
 transport.tcp.compress: true
 http.max_content_length: 100mb
 http.enabled: true
 discovery.zen.ping.unicast.hosts: ["192.168.1.1:9300","192.168.1.2:9300"]
./elasticsearch -d

over!


错误汇总:

[root2@datanode1 bin]$ ./elasticsearch
[2016-09-21 16:12:23,099][WARN ][bootstrap                ] unable to install syscall filter: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
[2016-09-21 16:12:23,398][INFO ][node                     ] [myNodeEs] version[2.4.0], pid[118119], build[ce9f0c7/2016-08-29T09:14:17Z]
[2016-09-21 16:12:23,398][INFO ][node                     ] [myNodeEs] initializing ...
Exception in thread "main" java.lang.IllegalStateException: Could not load plugin descriptor for existing plugin [head]. Was the plugin built before 2.0?
Likely root cause: java.nio.file.NoSuchFileException: /dwbi/elasticsearch-2.4.0/plugins/head/plugin-descriptor.properties
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:317)
at java.nio.file.Files.newByteChannel(Files.java:363)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:380)
at java.nio.file.Files.newInputStream(Files.java:108)
at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:87)
at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:378)
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:128)
at org.elasticsearch.node.Node.<init>(Node.java:158)
at org.elasticsearch.node.Node.<init>(Node.java:140)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:143)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.

解决方法:

cp /dwbi/elasticsearch-2.4.0/plugins/head/_site  /dwbi/elasticsearch-2.4.0/plugins/head/

华青莲日常点滴,方便自己,成长他人!!!


相关参考:

http://blog.csdn.net/july_2/article/details/24481935

http://blog.csdn.net/peibolinux/article/details/37560657

https://github.com/mobz/elasticsearch-head

http://www.mamicode.com/info-detail-873117.html

推荐 1
本文由 华青莲 创作,采用 知识共享署名-相同方式共享 3.0 中国大陆许可协议 进行许可。
转载、引用前需联系作者,并署名作者且注明文章出处。
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。

2 个评论

等进一步的应用介绍了。
好滴

要回复文章请先登录注册