Quantcast
Channel: Crunchify
Viewing all articles
Browse latest Browse all 1037

How to Install and Configure Elasticsearch on your Dev/Production environment?

$
0
0

How to Install and Configure Elasticsearch on Linux environment

In this tutorial we will go over steps on how to install and configure Elasticsearch for your development and production environment.

What is ElasticSearch?

One of the best search and analytics engine out there in the world. Elasticsearch is a distributed, JSON-based engine designed for horizontal scalability, maximum reliability, and easy management.

Elastic search centrally stores your data so you can discover the expected and uncover the unexpected. You could send all your logs from to ElasticSearch via Filebeat and visualize metrics instantly.

How to Start ElasticSearch as normal user

If you have any of below questions then you are at right place:

  • How To Install and Configure Elasticsearch on Ubuntu 16.04
  • Elasticsearch Setup and Configuration
  • Installing and Configuring Elasticsearch
  • How to Install and configure a remote Elasticsearch instance

Step-1) Install Elasticsearch

Here are the few simple commands to install Elasticsearch on your Linux/Ubuntu OS.

bash-3.2$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz

bash-3.2$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz.sha512

bash-3.2$ shasum -a 512 -c elasticsearch-6.7.0.tar.gz.sha512 

bash-3.2$ tar -xzf elasticsearch-6.7.0.tar.gz

bash-3.2$ cd elasticsearch-6.7.0/

And that’s it. Here are installation logs.

Installation logs:

crunch@localhost:/$ cd tmp/

crunch@localhost:/tmp$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz
--2019-03-30 14:41:25--  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz
Resolving artifacts.elastic.co (artifacts.elastic.co)... 2a04:4e42:a::734, 151.101.42.222
Connecting to artifacts.elastic.co (artifacts.elastic.co)|2a04:4e42:a::734|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 149006122 (142M) [application/x-gzip]
Saving to: ‘elasticsearch-6.7.0.tar.gz’

elasticsearch-6.7.0.tar.gz             100%[=========================================================================>] 142.10M   215MB/s    in 0.7s    

2019-03-30 14:41:26 (215 MB/s) - ‘elasticsearch-6.7.0.tar.gz’ saved [149006122/149006122]

crunch@localhost:/tmp$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz.sha512
--2019-03-30 14:41:26--  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz.sha512
Resolving artifacts.elastic.co (artifacts.elastic.co)... 2a04:4e42:a::734, 151.101.42.222
Connecting to artifacts.elastic.co (artifacts.elastic.co)|2a04:4e42:a::734|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 156 [application/octet-stream]
Saving to: ‘elasticsearch-6.7.0.tar.gz.sha512’

elasticsearch-6.7.0.tar.gz.sha512      100%[=========================================================================>]     156  --.-KB/s    in 0s      

2019-03-30 14:41:26 (24.2 MB/s) - ‘elasticsearch-6.7.0.tar.gz.sha512’ saved [156/156]

crunch@localhost:/tmp$ shasum -a 512 -c elasticsearch-6.7.0.tar.gz.sha512 
elasticsearch-6.7.0.tar.gz: OK

crunch@localhost:/tmp$ tar -xzf elasticsearch-6.7.0.tar.gz

crunch@localhost:/tmp$ cd elasticsearch-6.7.0/

crunch@localhost:/tmp/elasticsearch-6.7.0$ ./bin/elasticsearch
warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=1
[2019-03-30T14:42:15,073][INFO ][o.e.e.NodeEnvironment    ] [ZKsMkES] using [1] data paths, mounts [[/ (/dev/sda)]], net usable_space [69.8gb], net total_space [78.2gb], types [ext4]
[2019-03-30T14:42:15,079][INFO ][o.e.e.NodeEnvironment    ] [ZKsMkES] heap size [1007.3mb], compressed ordinary object pointers [true]
[2019-03-30T14:42:15,084][INFO ][o.e.n.Node               ] [ZKsMkES] node name derived from node ID [ZKsMkESwRL27iYEKUaBluQ]; set [node.name] to override
[2019-03-30T14:42:15,084][INFO ][o.e.n.Node               ] [ZKsMkES] version[6.7.0], pid[20094], build[default/tar/8453f77/2019-03-21T15:32:29.844721Z], OS[Linux/4.18.0-13-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.1/11.0.1+13-Ubuntu-3ubuntu3.18.10.1]
[2019-03-30T14:42:15,084][INFO ][o.e.n.Node               ] [ZKsMkES] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-6051013812527326393, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.path.home=/tmp/elasticsearch-6.7.0, -Des.path.conf=/tmp/elasticsearch-6.7.0/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2019-03-30T14:42:17,459][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [aggs-matrix-stats]
[2019-03-30T14:42:17,460][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [analysis-common]
[2019-03-30T14:42:17,460][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [ingest-common]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [ingest-geoip]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [ingest-user-agent]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [lang-expression]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [lang-mustache]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [lang-painless]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [mapper-extras]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [parent-join]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [percolator]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [rank-eval]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [reindex]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [repository-url]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [transport-netty4]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [tribe]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-ccr]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-core]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-deprecation]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-graph]
[2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-ilm]
[2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-logstash]
[2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-ml]
[2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-monitoring]
[2019-03-30T14:42:17,496][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-rollup]
[2019-03-30T14:42:17,497][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-security]
[2019-03-30T14:42:17,497][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-sql]
[2019-03-30T14:42:17,498][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-upgrade]
[2019-03-30T14:42:17,499][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-watcher]
[2019-03-30T14:42:17,499][INFO ][o.e.p.PluginsService     ] [ZKsMkES] no plugins loaded
[2019-03-30T14:42:22,899][INFO ][o.e.x.s.a.s.FileRolesStore] [ZKsMkES] parsed [0] roles from file [/tmp/elasticsearch-6.7.0/config/roles.yml]
[2019-03-30T14:42:24,035][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [ZKsMkES] [controller/20173] [Main.cc@109] controller (64 bit): Version 6.7.0 (Build d74ae2ac01b10d) Copyright (c) 2019 Elasticsearch BV
[2019-03-30T14:42:24,565][DEBUG][o.e.a.ActionModule       ] [ZKsMkES] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-03-30T14:42:24,896][INFO ][o.e.d.DiscoveryModule    ] [ZKsMkES] using discovery type [zen] and host providers [settings]
[2019-03-30T14:42:25,908][INFO ][o.e.n.Node               ] [ZKsMkES] initialized
[2019-03-30T14:42:25,908][INFO ][o.e.n.Node               ] [ZKsMkES] starting ...
[2019-03-30T14:42:26,087][INFO ][o.e.t.TransportService   ] [ZKsMkES] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2019-03-30T14:42:26,128][WARN ][o.e.b.BootstrapChecks    ] [ZKsMkES] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2019-03-30T14:42:29,217][INFO ][o.e.c.s.MasterService    ] [ZKsMkES] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2019-03-30T14:42:29,226][INFO ][o.e.c.s.ClusterApplierService] [ZKsMkES] new_master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2019-03-30T14:42:29,315][INFO ][o.e.h.n.Netty4HttpServerTransport] [ZKsMkES] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2019-03-30T14:42:29,316][INFO ][o.e.n.Node               ] [ZKsMkES] started
[2019-03-30T14:42:29,322][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [ZKsMkES] Failed to clear cache for realms [[]]
[2019-03-30T14:42:29,404][INFO ][o.e.g.GatewayService     ] [ZKsMkES] recovered [0] indices into cluster_state
[2019-03-30T14:42:29,692][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.watches] for index patterns [.watches*]
[2019-03-30T14:42:29,730][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2019-03-30T14:42:29,783][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.watch-history-9] for index patterns [.watcher-history-9*]
[2019-03-30T14:42:29,818][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*]
[2019-03-30T14:42:29,866][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*]
[2019-03-30T14:42:29,892][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6]
[2019-03-30T14:42:29,957][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*]
[2019-03-30T14:42:29,991][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*]
[2019-03-30T14:42:30,116][INFO ][o.e.l.LicenseService     ] [ZKsMkES] license [319113dd-7fb5-4ae5-8355-e2c7458b1532] mode [basic] - valid

Step-2) Start Elasticsearch Process

You need to make sure JAVA_HOME is setup correctly.

crunch@localhost:/usr/lib/jvm/java-11-openjdk-amd64/bin$ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin/
crunch@localhost:/usr/lib/jvm/java-11-openjdk-amd64/bin$ echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64/bin/

Start ElasticSearch process command:

./bin/elasticsearch

Make sure, you need to start Elastic Search using normal user. ElasticSearch won’t start as a root user and you will see below error if you try to run it as a root user.

java.lang.RuntimeException: can not run elasticsearch as root

Follow this tutorial on how to add non-root user and login.

Here is a console result output:

crunch@localhost:/tmp/elasticsearch-6.7.0$ ./bin/elasticsearch

warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=1
[2019-03-30T14:42:15,073][INFO ][o.e.e.NodeEnvironment    ] [ZKsMkES] using [1] data paths, mounts [[/ (/dev/sda)]], net usable_space [69.8gb], net total_space [78.2gb], types [ext4]
[2019-03-30T14:42:15,079][INFO ][o.e.e.NodeEnvironment    ] [ZKsMkES] heap size [1007.3mb], compressed ordinary object pointers [true]
[2019-03-30T14:42:15,084][INFO ][o.e.n.Node               ] [ZKsMkES] node name derived from node ID [ZKsMkESwRL27iYEKUaBluQ]; set [node.name] to override
[2019-03-30T14:42:15,084][INFO ][o.e.n.Node               ] [ZKsMkES] version[6.7.0], pid[20094], build[default/tar/8453f77/2019-03-21T15:32:29.844721Z], OS[Linux/4.18.0-13-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.1/11.0.1+13-Ubuntu-3ubuntu3.18.10.1]
[2019-03-30T14:42:15,084][INFO ][o.e.n.Node               ] [ZKsMkES] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-6051013812527326393, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.path.home=/tmp/elasticsearch-6.7.0, -Des.path.conf=/tmp/elasticsearch-6.7.0/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2019-03-30T14:42:17,459][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [aggs-matrix-stats]
[2019-03-30T14:42:17,460][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [analysis-common]
[2019-03-30T14:42:17,460][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [ingest-common]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [ingest-geoip]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [ingest-user-agent]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [lang-expression]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [lang-mustache]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [lang-painless]
[2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [mapper-extras]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [parent-join]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [percolator]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [rank-eval]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [reindex]
[2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [repository-url]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [transport-netty4]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [tribe]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-ccr]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-core]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-deprecation]
[2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-graph]
[2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-ilm]
[2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-logstash]
[2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-ml]
[2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-monitoring]
[2019-03-30T14:42:17,496][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-rollup]
[2019-03-30T14:42:17,497][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-security]
[2019-03-30T14:42:17,497][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-sql]
[2019-03-30T14:42:17,498][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-upgrade]
[2019-03-30T14:42:17,499][INFO ][o.e.p.PluginsService     ] [ZKsMkES] loaded module [x-pack-watcher]
[2019-03-30T14:42:17,499][INFO ][o.e.p.PluginsService     ] [ZKsMkES] no plugins loaded
[2019-03-30T14:42:22,899][INFO ][o.e.x.s.a.s.FileRolesStore] [ZKsMkES] parsed [0] roles from file [/tmp/elasticsearch-6.7.0/config/roles.yml]
[2019-03-30T14:42:24,035][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [ZKsMkES] [controller/20173] [Main.cc@109] controller (64 bit): Version 6.7.0 (Build d74ae2ac01b10d) Copyright (c) 2019 Elasticsearch BV
[2019-03-30T14:42:24,565][DEBUG][o.e.a.ActionModule       ] [ZKsMkES] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-03-30T14:42:24,896][INFO ][o.e.d.DiscoveryModule    ] [ZKsMkES] using discovery type [zen] and host providers [settings]
[2019-03-30T14:42:25,908][INFO ][o.e.n.Node               ] [ZKsMkES] initialized
[2019-03-30T14:42:25,908][INFO ][o.e.n.Node               ] [ZKsMkES] starting ...
[2019-03-30T14:42:26,087][INFO ][o.e.t.TransportService   ] [ZKsMkES] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2019-03-30T14:42:26,128][WARN ][o.e.b.BootstrapChecks    ] [ZKsMkES] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2019-03-30T14:42:29,217][INFO ][o.e.c.s.MasterService    ] [ZKsMkES] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2019-03-30T14:42:29,226][INFO ][o.e.c.s.ClusterApplierService] [ZKsMkES] new_master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2019-03-30T14:42:29,315][INFO ][o.e.h.n.Netty4HttpServerTransport] [ZKsMkES] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2019-03-30T14:42:29,316][INFO ][o.e.n.Node               ] [ZKsMkES] started
[2019-03-30T14:42:29,322][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [ZKsMkES] Failed to clear cache for realms [[]]
[2019-03-30T14:42:29,404][INFO ][o.e.g.GatewayService     ] [ZKsMkES] recovered [0] indices into cluster_state
[2019-03-30T14:42:29,692][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.watches] for index patterns [.watches*]
[2019-03-30T14:42:29,730][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2019-03-30T14:42:29,783][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.watch-history-9] for index patterns [.watcher-history-9*]
[2019-03-30T14:42:29,818][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*]
[2019-03-30T14:42:29,866][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*]
[2019-03-30T14:42:29,892][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6]
[2019-03-30T14:42:29,957][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*]
[2019-03-30T14:42:29,991][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*]
[2019-03-30T14:42:30,116][INFO ][o.e.l.LicenseService     ] [ZKsMkES] license [319113dd-7fb5-4ae5-8355-e2c7458b1532] mode [basic] - valid

Step-3) Check Elasticsearchprocess process

How to make sure Elasticsearch is running?

command: ps -few | grep elastic

crunch@localhost:/tmp/elasticsearch-6.7.0$ ps -few | grep elastic
crunch   20305     1 99 14:46 pts/0    00:00:28 /usr/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch-5628366226360196103 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m -Djava.locale.providers=COMPAT -XX:UseAVX=2 -Des.path.home=/tmp/elasticsearch-6.7.0 -Des.path.conf=/tmp/elasticsearch-6.7.0/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /tmp/elasticsearch-6.7.0/lib/* org.elasticsearch.bootstrap.Elasticsearch -d
crunch   20320 20305  0 14:46 pts/0    00:00:00 /tmp/elasticsearch-6.7.0/modules/x-pack-ml/platform/linux-x86_64/bin/controller
crunch   20362 20062  0 14:46 pts/0    00:00:00 grep --color=auto elastic

That’s it. You are all set running ElasticSearch.

Default elasticsearch startup file:

crunch@localhost:/tmp/elasticsearch-6.7.0/bin$ pwd
/tmp/elasticsearch-6.7.0/bin

crunch@localhost:/tmp/elasticsearch-6.7.0/bin$ vi elasticsearch

elasticsearch file content:

source "`dirname "$0"`"/elasticsearch-env

ES_JVM_OPTIONS="$ES_PATH_CONF"https://cdn.crunchify.com/jvm.options
JVM_OPTIONS=`"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.launchers.JvmOptionsParser "$ES_JVM_OPTIONS"`
ES_JAVA_OPTS="${JVM_OPTIONS//\$\{ES_TMPDIR\}/$ES_TMPDIR} $ES_JAVA_OPTS"

cd "$ES_HOME"
# manual parsing to find out, if process should be detached
if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' > /dev/null; then
  exec \
    "$JAVA" \
    $ES_JAVA_OPTS \
    -Des.path.home="$ES_HOME" \
    -Des.path.conf="$ES_PATH_CONF" \
    -Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
    -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
    -cp "$ES_CLASSPATH" \
    org.elasticsearch.bootstrap.Elasticsearch \
    "$@"
else
  exec \
    "$JAVA" \
    $ES_JAVA_OPTS \
    -Des.path.home="$ES_HOME" \
    -Des.path.conf="$ES_PATH_CONF" \
    -Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
    -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
    -cp "$ES_CLASSPATH" \
    org.elasticsearch.bootstrap.Elasticsearch \
    "$@" \
    <&- &
  retval=$?
  pid=$!
  [ $retval -eq 0 ] || exit $retval
  if [ ! -z "$ES_STARTUP_SLEEP_TIME" ]; then
    sleep $ES_STARTUP_SLEEP_TIME
  fi
  if ! ps -p $pid > /dev/null ; then
    exit 1
  fi
  exit 0
fi

exit $?

What’s next? Setup Filebeat.

How to install and configure Filebeat? Lightweight Log Forwarder for Dev/Prod Environment

The post How to Install and Configure Elasticsearch on your Dev/Production environment? appeared first on Crunchify.


Viewing all articles
Browse latest Browse all 1037

Trending Articles