Installation and Startup of Elasticsearch under UBUNTU

Keywords: ElasticSearch Java sudo network

1. Installation

1. Add ppa source

sudo add-apt-repository ppa:openjdk-r/ppa

2. Upgrade system apt-get source

sudo apt-get update

3. Install jdk8

Elasticsearch was developed in practical java, so JVM is required to run, so we need to install jdk
 sudo apt-get install oracle-java8-installer

4. Check jdk

Execute the following command to check for successful installation

java-version

When the installation is successful, it will be displayed

java version "1.8.0_151"
java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HostSpot(TM) 64-Bit Serve VM (build 25.151-b12,mixed mod)

5. Download elasticsearch

wget 'https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/2.1.1/elasticsearch-2.1.1.zip'

6. Installation

After the download is complete

unzip elasticsearch-2.1.1.zip

2. Startup

1. Enter the elasticsearch-2.1.1 directory:

cd elasticsearch-2.1.1/bin
./elasticsearch -d #Background running

View startup log

cat  ~/elasticsearch-2.1.1/logs/elasticsearch.log
[2017-12-05 18:13:19,941][INFO ][node                     ] [Stentor] version[2.1.1], pid[10604], build[40e2c53/2015-12-15T13:05:55Z]
[2017-12-05 18:13:19,944][INFO ][node                     ] [Stentor] initializing ...
[2017-12-05 18:13:20,099][INFO ][plugins                  ] [Stentor] loaded [], sites []
[2017-12-05 18:13:20,167][INFO ][env                      ] [Stentor] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [34.1gb], net total_space [48.1gb], spins? [possibly], types [ext4]
[2017-12-05 18:13:23,519][INFO ][node                     ] [Stentor] initialized
[2017-12-05 18:13:23,526][INFO ][node                     ] [Stentor] starting ...
[2017-12-05 18:13:23,686][INFO ][transport                ] [Stentor] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2017-12-05 18:13:23,700][INFO ][discovery                ] [Stentor] elasticsearch/7uAQwPTtT12pIg65F40skg
[2017-12-05 18:13:26,839][INFO ][cluster.service          ] [Stentor] new_master {Stentor}{7uAQwPTtT12pIg65F40skg}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2017-12-05 18:13:26,890][INFO ][http                     ] [Stentor] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2017-12-05 18:13:26,892][INFO ][node                     ] [Stentor] started
[2017-12-05 18:13:26,943][INFO ][gateway                  ] [Stentor] recovered [0] indices into cluster_state
[2017-12-05 18:13:53,325][INFO ][node                     ] [Stentor] stopping ...
[2017-12-05 18:13:53,363][INFO ][node                     ] [Stentor] stopped
[2017-12-05 18:13:53,364][INFO ][node                     ] [Stentor] closing ...
[2017-12-05 18:13:53,380][INFO ][node                     ] [Stentor] closed
[2017-12-05 18:14:11,638][INFO ][node                     ] [Stratosfire] version[2.1.1], pid[10676], build[40e2c53/2015-12-15T13:05:55Z]
[2017-12-05 18:14:11,638][INFO ][node                     ] [Stratosfire] initializing ...
[2017-12-05 18:14:11,770][INFO ][plugins                  ] [Stratosfire] loaded [], sites []
[2017-12-05 18:14:11,816][INFO ][env                      ] [Stratosfire] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [34.1gb], net total_space [48.1gb], spins? [possibly], types [ext4]
[2017-12-05 18:14:14,889][INFO ][node                     ] [Stratosfire] initialized
[2017-12-05 18:14:14,889][INFO ][node                     ] [Stratosfire] starting ...
[2017-12-05 18:14:14,968][INFO ][transport                ] [Stratosfire] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2017-12-05 18:14:14,977][INFO ][discovery                ] [Stratosfire] elasticsearch/vb354W3uRsKroymTxyA_Tg
[2017-12-05 18:14:18,059][INFO ][cluster.service          ] [Stratosfire] new_master {Stratosfire}{vb354W3uRsKroymTxyA_Tg}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2017-12-05 18:14:18,092][INFO ][http                     ] [Stratosfire] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2017-12-05 18:14:18,092][INFO ][node                     ] [Stratosfire] started
[2017-12-05 18:14:18,107][INFO ][gateway                  ] [Stratosfire] recovered [0] indices into cluster_state

2. Access

Access elastcseach on virtual machine UBUNTU locally
Default port is 9200

http://192.168.1.38:9200/

Access was found to have failed because no external network access was set.

3. Set up access to the external network

Modify the elasticseach configuration file

vi /elasticsearch-2.1.1/config/elasticsearch.yml

findNetwork.hostIn this line, change to

# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0 #Allow access to any port
#
# Set a custom port for HTTP:

4. Normal Access

Restart service, access http://192.168.1.38:9200/ display

Elasticsearch was initially installed successfully, and the specific configuration of elasticsearch needs further research.

Posted by KenGR on Thu, 09 Jul 2020 08:06:18 -0700