CENTOS7 Virtual Machine Installation elasticsearch5.0.x-installation article

Source: Internet
Author: User

Please install the JDK beforehand Create a new user (non-root user)

Elasticsearch can only be started with a non-root, where I created a user named Seven

[Root@localhost ~]# useradd Seven [root@localhost ~]# passwd-Seven
Download Elasticsearch
[Root@localhost ~]# su seven
[seven@localhost root]$ cd/home/seven [seven@localhost ~]$ mkdir] Download
[ Seven@localhost ~]$ cd Download
[Seven@localhost download]$ wget Release/org/elasticsearch/distribution/tar/elasticsearch/5.0.0-alpha3/elasticsearch-5.0.0-alpha3.tar.gz
Unpack and run Elasticsearch

Extract

[Seven@localhost download]$ TAR-ZXVF elasticsearch-5.0.0-alpha3.tar.gz

Move to a specified folder and rename it (easy to manage)

[Seven@localhost download]$ MV Elasticsearch-5.0.0-alpha3/usr/java/elasticsearch

Modify IP and port access to Elasticsearch

[Seven@localhost config]$ Vim/usr/java/elasticsearch/config/elasticsearch.yml

Locate the following code snippet and cancel the comment on the line network.host and http.port, modify IP and port

#----------------------------------Network-----------------------------------
# # Set The bind address to
a Specific IP (IPV4 or IPV6):
#
network.host:192.168.0.155
#
Set a custom port for http:
#
http. port:9200
#
For more information, and the documentation at:
# 

Run Bin/elasticsearch file directly to start Elasticsearch

[Seven@localhost bin]$ cd/usr/java/elasticsearch/bin/
[seven@localhost bin]$./elasticsearch

found an error when starting ...

[Seven@localhost bin]$./elasticsearch [2016-06-28 13:49:27,899][info][node] [Mondo] Version[5.0.0-a LPHA3], pid[3671], build[cad959b/2016-05-26t08:25:57.564z], os[linux/3.10.0-327.el7.x86_64/amd64], JVM[Oracle                     Corporation/java HotSpot (TM) 64-bit Server vm/1.0_91/25.91-b14]▽2016-06-28 13:49:27,900][info
] [Mondo] initializing ... [2016-06-28 13:49:28,941] [INFO] [Plugins] [Mondo] modules [Percolator, Lang-mustache, lang-painless, Ingest-grok, Reindex, Lang-expression, Lang-groovy], plugins [] [2016-06-28 13:49:28,963][info][env] [Mondo] using [1] data paths, mounts [[/(ROOTFS)]], net us Able_space [15.7GB], net total_space [17.4GB], spins? [Unknown], types [Rootfs] [2016-06-28 13:49:28,963][info][env] [mondo] heap size [1.9GB], Compresse D Ordinary Object pointers [true] [2016-06-28 13:49:31,980][info][node] [mondo] initialized [2016-06 -28 13:49:31,980][INFO] [Node]
[Mondo] Starting ... [2016-06-28 13:49:32,115] [INFO] [Transport] [Mondo] publish_address {192.168.0.155:9300}, bound_addresses {192.168.0.155:9300} Exception in thread ' main ' Java.lang.RuntimeException:bootstrap checks failed initial heap size [268435456] not equal to maximum heap size [21474836 48]; This can cause resize pauses and prevents Mlockall from locking the entire heap max file descriptors [4096] for Elasticsea RCH process likely too low, increase to at least [65536] please set [discovery.zen.minimum_master_nodes] to a majority of The number of master eligible nodes in your cluster max virtual memory areas Vm.max_map_count [65530] likely too low, incr Ease to in least [262144] at Org.elasticsearch.bootstrap.BootstrapCheck.check (bootstrapcheck.java:125) at Org.elasticsearch.bootstrap.BootstrapCheck.check (bootstrapcheck.java:85) at
  Org.elasticsearch.bootstrap.BootstrapCheck.check (bootstrapcheck.java:65)      At Org.elasticsearch.bootstrap.bootstrap$5.validatenodebeforeacceptingrequests (Bootstrap.java:183) at Org.el
        Asticsearch.node.Node.start (node.java:337) at Org.elasticsearch.bootstrap.Bootstrap.start (bootstrap.java:198) At Org.elasticsearch.bootstrap.Bootstrap.init (bootstrap.java:257) at Org.elasticsearch.bootstrap.Elasticsearch . Init (elasticsearch.java:96) at Org.elasticsearch.bootstrap.Elasticsearch.execute (elasticsearch.java:91) A T Org.elasticsearch.cli.SettingCommand.execute (settingcommand.java:54) at Org.elasticsearch.cli.Command.mainWitho Uterrorhandling (command.java:91) at Org.elasticsearch.cli.Command.main (command.java:53) at Org.elasticsear Ch.bootstrap.Elasticsearch.main (elasticsearch.java:70) at Org.elasticsearch.bootstrap.Elasticsearch.main (
ELASTICSEARCH.JAVA:63) refer to the log for complete error details. [2016-06-28 13:49:32,144] [INFO] [Node]
[Mondo] stopping ... [2016-06-28 13:49:32,198][info][node] [Mondo] stopped [2016-06-28 13:49:32,198][info-][node
] [Mondo] closing ... [2016-06-28 13:49:32,210] [INFO] [Node] [Mondo] Closed

So I temporarily raised the size of the vm.max_map_count.
* This operation requires root permission

[Root@localhost ~]# sysctl-w vm.max_map_count=262144

View Modify Results

[Root@localhost ~]# sysctl-a|grep vm.max_map_count
vm.max_map_count = 262144

or permanently modified.

[Root@localhost ~]# cat/etc/sysctl.conf | Grep-v "Vm.max_map_count" >/tmp/system_sysctl.conf
[root@localhost ~]# echo "vm.max_map_count=262144" > >/tmp/system_sysctl.conf
[root@localhost ~]# mv/tmp/system_sysctl.conf/etc/sysctl.conf
mv: Overwrite "/etc/ Sysctl.conf ". Y
[root@localhost ~]# cat/etc/sysctl.conf
# System default Settings Live in/usr/lib/sysctl.d/00-system.conf.< c5/># to override those settings, enter new settings where, or in an/etc/sysctl.d/<name>.conf file
# for
m Ore information, sysctl.conf (5) and SYSCTL.D (5).
vm.max_map_count=262144
[root@localhost ~]# sysctl-p
vm.max_map_count = 262144

There's one more error. About JVM memory allocation heap size [268435456] not equal to maximum heap size [2147483648], JVM configuration needs to be modified

[Seven@localhost bin]$ Vim/usr/java/elasticsearch/config/jvm.options

Change the-xmx2g to-xmx256m, which is the value of heap size [268435456]/1024/1024

There are new errors in

...

Exception in thread ' main ' java.lang.RuntimeException:bootstrap checks failed initial heap size [268435456] not equal to Maximum heap size [2147483648]; This can cause resize pauses and prevents Mlockall from locking the entire heap max file descriptors [4096] for Elasticsea RCH process likely too, increase to at least [65536] memory locking requested for elasticsearch process but memory Not locked at Org.elasticsearch.bootstrap.BootstrapCheck.check (bootstrapcheck.java:125) at Org.elasticsear Ch.bootstrap.BootstrapCheck.check (bootstrapcheck.java:85) at Org.elasticsearch.bootstrap.BootstrapCheck.check ( BOOTSTRAPCHECK.JAVA:65) at Org.elasticsearch.bootstrap.bootstrap$5.validatenodebeforeacceptingrequests (Bootstrap . java:183) at Org.elasticsearch.node.Node.start (node.java:337) at Org.elasticsearch.bootstrap.Bootstrap.st Art (bootstrap.java:198) at Org.elasticsearch.bootstrap.Bootstrap.init (bootstrap.java:257) at org.elasticSearch.bootstrap.Elasticsearch.init (elasticsearch.java:96) at Org.elasticsearch.bootstrap.Elasticsearch.execute ( elasticsearch.java:91) at Org.elasticsearch.cli.SettingCommand.execute (settingcommand.java:54) at Org.elas Ticsearch.cli.Command.mainWithoutErrorHandling (command.java:91) at Org.elasticsearch.cli.Command.main ( command.java:53) at Org.elasticsearch.bootstrap.Elasticsearch.main (elasticsearch.java:70) at ORG.ELASTICSE
Arch.bootstrap.Elasticsearch.main (ELASTICSEARCH.JAVA:63) refer to the log for complete error details. [2016-06-28 14:55:49,770] [INFO] [Node]
[Goldbug] stopping ... [2016-06-28 14:55:49,875] [INFO] [Node]
[Goldbug] stopped [2016-06-28 14:55:49,875][info][node] [Goldbug] closing ... [2016-06-28 14:55:49,887] [INFO] [Node] [Goldbug] Closed

This problem has been killing me all afternoon, finally found a solution, the same back to config/ ELASTICSEARCH.YML files, find the following configuration, open Discovery.zen.ping.unicast.hosts and Discovery.zen.minimum_master_nodes

#---------------------------------Discovery----------------------------------
# Pass an
initial list of Hosts to perform discovery when new node are started:
# The default list of hosts is ["127.0.0.1", "[:: 1]"]
#
D Iscovery.zen.ping.unicast.hosts: ["192.168.0.155"]
#
prevent the "split brain" by configuring the majority of N Odes (total number of NODES/2 + 1):
#
Discovery.zen.minimum_master_nodes:3
#
For more information, s EE the documentation at:
# 

Then modify the max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536] This error (Switch to root operation)

[Root@localhost ~]# cp/etc/security/limits.conf/etc/security/limits.conf.bak
[root@localhost ~]# cat/etc/ security/limits.conf | Grep-v "Seven" >/tmp/system_limits.conf
[root@localhost ~]# echo "Seven hard nofile 65536" >>/tmp/system_l imits.conf 
[Root@localhost ~]# echo "Seven soft nofile 65536" >>/tmp/system_limits.conf 
[root@localhost ~]# mv/tmp/system_limits.conf/etc/security/limits.conf

After modification, log on to the seven user, and use the following command to see if the modification succeeded

[Seven@localhost ~]$ ulimit-hn
65536

The next step is to start the Elasticsearch and start the complete use of the browser to access http://192.168.0.155:9200

{
  "name": "Vampire by Night",
  "cluster_name": "Elasticsearch",
  "version": {
    "number": "5.0.0-ALPHA3" , "
    Build_hash": "cad959b",
    "build_date": "2016-05-26t08:25:57.564z",
    "Build_snapshot": false,
    " Lucene_version ":" 6.0.0 "
  },
  " tagline ":" You Know, for Search "
}

Finally succeeded, currently only encountered these problems, there are other issues to welcome the exchange.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.