This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11957|Reply: 3

Centos 7 installation and deployment elasticsearch-6.5.2 tutorial

[Copy link]
Posted on 12/11/2018 4:45:13 PM | | | |
Introduction to ElasticSearch

What is ElasticSearch:

  • ElasticSearch is an open-source search engine built on Apache Lucene
  • Written in Java, it provides a simple and easy-to-use RESTFul API
  • Easy scale-out to support petabyte-level structured or unstructured data processing


Application Scenarios:

  • Massive data analysis engine
  • On-site search engine
  • As a data warehouse

Document address:The hyperlink login is visible.

Deployment Environment:

CentOS 7 x64-bit, Elasticsearch version 6.5.2, JDK 1.8.0.191

1: Install JDK 1.8.0

ElasticSearch is sensitive to the version of the JRE, and the wrong version will cause ElasticSearch to not work.

Centos 7 Installation Java JDK Tutorial
https://www.itsvse.com/thread-6169-1-1.html
(Source: Architect_Programmer)

2: Download and run ElasticSearch 6.5.2

Download the address page:The hyperlink login is visible.

[root@VM_0_9_centos elasticsearch-6.5.2]# ./bin/elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX: ParallelGCThreads=N
[2018-12-11T15:24:27,847] [WARN ] [o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.5.2.jar:6.5.2]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.5.2.jar:6.5.2]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.5.2.jar:6.5.2]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.5.2.jar:6.5.2]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.5.2.jar:6.5.2]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.5.2.jar:6.5.2]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.5.2.jar:6.5.2]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.5.2.jar:6.5.2]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.5.2.jar:6.5.2]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.5.2.jar:6.5.2]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.5.2.jar:6.5.2]
        ... 6 more



Elasticsearch requires that you can't run with superuser root, so we can create an account casually, and I have to use the user as es



If there is no error, it runs successfully

Open a new terminal and access it with curl


In the case of making sure that the server port (9200) is on, elasticsearch is started (ps -ef | grep elasticsearch) can be accessed in the browser

[root@VM_0_9_centos local]# curl 'http://localhost:9200/?pretty'
{
  "name" : "iUSRV4T",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "WCbka65VTd2TnM8gQvztqg",
  "version" : {
    "number" : "6.5.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "9434bed",
    "build_date" : "2018-11-29T23:58:20.891072Z",
    "build_snapshot" : false,
    "lucene_version" : "7.5.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}



3: Access Elasticsearch over the Internet

Edit the elasticsearch configuration file



Find network.host: a line, remove the # sign, and change it to:


(network.host: [_local_, 172.30.6.1] 172.30.6.1 is the specified IP address, which can be multiple IP addresses. Not tested)

Restart Elasticsearch, and then you can access the http://ip:9200 interface on the Internet.



Possible errors:

Mistake one

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

The value of max_map_count refers to the maximum memory map areas available to a process, which is used when calling malloc and is generated by mmap/mprotect.

Workaround: Increase the size of vm.max_map_count:





Mistake two

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

Solution

After the modification, log in to the ES user again and use the following command to check whether the modification is successful

Mistake 3

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

Solution

atAli saidPossible problems on the
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

Solution: Add the following command to the elasticsearch configuration








Previous:SEO Core Techniques Pure White Hat Quick Ranking Method
Next:Kai-Fu Lee: 40 lessons on the future of AI (latest on September 12)
 Landlord| Posted on 12/12/2018 4:58:29 PM |
Install the elasticsearch-6.5.2 elasticsearch-head plugin
https://www.itsvse.com/thread-6190-1-1.html
(Source: Architect_Programmer)
 Landlord| Posted on 1/10/2020 9:27:13 AM |
The disk space usage has reached 95% of the disk space of the Es Judge node. The index is then set to read-only and cannot be written.  Yesterday, the test server inserted 10G data, and there was 5G left on the disk behind,,I came over in the morning and couldn't write it in[0]: index returned 403 _index: ds_home_type: ds_homeg _id: f8z7j _version: 0 error: Type: cluster_block_exception Reason: "blocked by: [ FORBIDDEN/12/index read-only / allow delete (api)]。
 Landlord| Posted on 12/21/2021 5:00:35 PM |
Reset the replica to 0, if the data is not particularly important, you can adopt this configuration to relieve the pressure of writing es.

Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com