centos陆.5安装elasticsearch

java下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
es下载地址 :https://www.elastic.co/downloads/elasticsearch

1. 先安装java
一)检查体系中是还是不是早已设置了java:
  java -version

贰)进一步查看JDK音讯:
  rpm -qa | grep java

3)卸载openJDK
  rpm -e –nodeps tzdata-java-2012c-1.el6.noarch
  rpm -e –nodeps java-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64

4)安装JDK
  rpm -ivh jdk-7-linux-i586.rpm

  JDK暗许安装在/usr/java中,使用rpm 的
–prefix参数修改安装目录

5) 查看安装是不是正规
  java -version

  java version “1.7.0_45”
  Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
  Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)

陆)配置意况变量
  vim /etc/profile

  在文件中投入以下内容:
  JAVA_HOME=/usr/java/jdk1.7.0_45
  JRE_HOME=/usr/java/jdk1.7.0_45/jre
  PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
  CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
  export JAVA_HOME JRE_HOME PATH CLASSPATH

七)是陈设生效
  source /etc/profile

8)查看PATH
  echo $PATH

2. es安装
一) 将es压缩文件移到/opt中
  mv elasticsearch-2.1.1.tar.gz /opt cd /opt

2)解压,重命名
  tar zxvf elasticsearch-2.1.1.tar.gz
  mv elasticsearch-2.1.1 elasticsearch

叁)用root用户运营es会报错
  Exception in thread “main” java.lang.RuntimeException: don’t run
elasticsearch as root.
  at
org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
  at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
  at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
  at
org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
  Refer to the log for complete error details.

四)由于ElasticSearch能够收到用户输入的本子并且施行,为了系统安全记挂,
建议创造一个独自的用户用来运维ElasticSearch
  groupadd elsearch
  useradd elsearch -g elsearch -p elasticsearch

5)退换elasticsearch文件夹及中间文件的所属用户及组为elsearch:elsearch
  cd /opt
  chown -R elsearch:elsearch elasticsearch

6)切换成elsearch用户再起步
  su elsearch cd elasticsearch/bin
  ./elasticsearch

七)运转后打字与印刷音信如下
  [2016-08-31 02:56:08,152][WARN ][bootstrap ] unable to install
syscall filter: seccomp unavailable: CONFIG_SECCOMP not compiled into
kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
  [2016-08-31 02:56:08,280][INFO ][node ] [Bulldozer]
version[2.3.5], pid[9219], build[90f439f/2016-07-27T10:36:52Z]
  [2016-08-31 02:56:08,280][INFO ][node ] [Bulldozer]
initializing …
  [2016-08-31 02:56:08,832][INFO ][plugins ] [Bulldozer]
modules [reindex, lang-expression, lang-groovy], plugins [], sites
[]
  [2016-08-31 02:56:08,847][INFO ][env ] [Bulldozer] using
[1] data paths, mounts [[/ (/dev/sda2)]], net usable_space
[8.8gb], net total_space [17.3gb], spins? [possibly], types
[ext4]
  [2016-08-31 02:56:08,847][INFO ][env ] [Bulldozer] heap size
[990.7mb], compressed ordinary object pointers [true]
  [2016-08-31 02:56:08,847][WARN ][env ] [Bulldozer] max file
descriptors [4096] for elasticsearch process likely too low, consider
increasing to at least [65536]
  [2016-08-31 02:56:10,448][INFO ][node ] [Bulldozer]
initialized
  [2016-08-31 02:56:10,448][INFO ][node ] [Bulldozer] starting

  [2016-08-31 02:56:10,521][INFO ][transport ] [Bulldozer]
publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300},
{127.0.0.1:9300}
  [2016-08-31 02:56:10,525][INFO ][discovery ] [Bulldozer]
elasticsearch/2HMN20ynTwO4KDPdGBWFuQ
  [2016-08-31 02:56:13,648][INFO ][cluster.service ]
[Bulldozer] new_master
{Bulldozer}{2HMN20ynTwO4KDPdGBWFuQ}{127.0.0.1}{127.0.0.1:9300}, reason:
zen-disco-join(elected_as_master, [0] joins received)
  [2016-08-31 02:56:13,678][INFO ][http ] [Bulldozer]
publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200},
{127.0.0.1:9200}
  [2016-08-31 02:56:13,678][INFO ][node ] [Bulldozer]
started
  [2016-08-31 02:56:13,716][INFO ][gateway ] [Bulldozer]
recovered [0] indices into cluster_state

八)ElasticSearch后端运转命令
  ./elasticsearch -d

注:java和es版本自行修改

参考文章:http://my.oschina.net/topeagle/blog/591451?fromerr=mzOr2qzZ
     http://www.centoscn.com/image-text/config/2015/0208/4658.html

相关文章