This is the second day of my participation in the August Text Challenge.More challenges in August

Elasticsearch is used in the company project.

The project relies on Elasticsearch

Download the installation package: www.elastic.co/cn/download…

Decompress the installation package

Open the terminal and run the command to go to the bin directory to run the ElasticSearch file

I have the package on my desktop, so use the following command:

$ cd Desktop/elasticsearch-5.3. 0/bin/
$ elasticsearch
Copy the code

Error after running:

No Java runtime present, requesting install.
Elasticsearch requires at least Java 8 but your Java version from /usr/bin/java does not meet this requirement
Copy the code

You need to install the JDK for the Java environment to run

Download the installation package: www.oracle.com/technetwork…

Once you have unpacked the archive, Elasticsearch is ready to run. Start Elasticsearch in the foreground by doing the following:

CD elasticSearch -<version>./bin/ elasticSearch ① ②Copy the code

If you want to run Elasticsearch as a daemon in the background, you can add the -d parameter.

If you are running Elasticseach on Windows, you should run bin\ ElasticSearch. bat instead of bin\ ElasticSearch.

To test whether Elasticsearch has started successfully, open another terminal and perform the following operations:

curl 'http://localhost:9200/? pretty'Copy the code

You should get a response like the following:

{"name" : "Tom Foster", "cluster_name" : "ElasticSearch ", "version" : {"number" : "2.1.0", "build_hash" : "72cd1f1a3eee09505e036106146dc1949dc5dc87", "build_timestamp" : "2015-11-18T22:40:03Z", "build_snapshot" : False, "lucene_version" : "5.3.1"}, "tagline" : "You Know, for Search"}Copy the code

Elastic Search startup error

The cause may be that the es running before has not been shut down properly.

Npiabbd1e: ElasticSearch -5.3.0 lijunshuang$./bin/ ElasticSearch [2019-02-16t11:28:31.082][INFO][o.e.n.mode][] initializing ... [the 2019-02-16 T11: and thou, 128] [WARN] [O.E.B.E lasticsearchUncaughtExceptionHandler] [] uncaught exception in the thread (main) org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, Tried the [[/ Users/lijunshuang/Desktop/work/elasticsearch - 5.3.0 / data/elasticsearch]] with the lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])? The at org. Elasticsearch. The bootstrap. Elasticsearch. Init (elasticsearch. Java: 127) ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. The bootstrap. Elasticsearch. Execute (elasticsearch. Java: 114) ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. Cli. EnvironmentAwareCommand. Execute (EnvironmentAwareCommand. Java: 58) ~ [elasticsearch - 5.3.0. Jar: 5.3.0] At org.elasticsearch.cli.Com mand. MainWithoutErrorHandling (122). The Command Java: ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org.elasticsearch.cli.Com mand. Main (88). The Command Java: ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. The bootstrap. Elasticsearch. Main (elasticsearch. Java: 91) ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. The bootstrap. Elasticsearch. Main (elasticsearch. Java: 84) ~ [elasticsearch - 5.3.0. Jar: 5.3.0] under Caused by: java.lang.IllegalStateException: failed to obtain node locks, Tried the [[/ Users/lijunshuang/Desktop/work/elasticsearch - 5.3.0 / data/elasticsearch]] with the lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])? The at org. Elasticsearch. Env. NodeEnvironment. < init > (NodeEnvironment. Java: 260) ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. Node. Node. < init > (node. Java: 258) ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. Node. Node. < init > (node. Java: 238) ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. The bootstrap. The bootstrap $6. < init > (242) the bootstrap. Java: ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. The bootstrap. The bootstrap. Setup (242) the bootstrap. Java: ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. The bootstrap. The bootstrap. Init (360) the bootstrap. Java: ~ [elasticsearch - 5.3.0. Jar: 5.3.0] the at Org. Elasticsearch. The bootstrap. Elasticsearch. Init (elasticsearch. Java: 123) ~ [elasticsearch - 5.3.0. Jar: 5.3.0]... 6 moreCopy the code

1. View the process

$ps aux | grep 'elastic'.Copy the code

2. Close the process

$kill -9 Indicates the process IDCopy the code

3. Restart ES.

./bin/elasticsearch
Copy the code

Check startup success.

Thank you

Thank you in your busy schedule to open this article, I hope to help you, if you have any questions, welcome to point out.

If you think it’s okay, give it a thumbs up.