Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Steps for Centos7 installation and configuration of JDK and ElasticSearch

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "Centos7 installation and configuration of JDK and ElasticSearch steps", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Centos7 installation and configuration of JDK and ElasticSearch steps" bar!

Experimental environment:

Operating system: Centos 7.5

Server ip:192.168.1.198

Running user: root

Network environment: Internet

I. operating environment

JDK:1.8.0_171 (JAVA_SE)

Elasticsearch-6.3.1 (JDK can only use version 1.8)

Logstash-6.3.1

Kibana-6.3.1

Second, install Java and Elasticsearch

1. Install JDK

Download JDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html; this environment downloads the 64-bit tar.gz package, copy the installation package to the installation server / usr/local directory

[root@localhost ~] # cd / usr/local/

[root@localhost local] # tar-xzvf jdk-8u171-linux-x64.tar.gz

[root@localhost local] # mv jdk1.8.0_171 java

2. Configure JDK environment variables

Method 1:

[root@localhost local] # vim / etc/profile

Add the following to the end of the file (if the server requires multiple versions of JDK, you can also add the contents of the environment variable to the startup script of ELK later in order that ELK does not affect other systems)

JAVA_HOME=/usr/local/java

JRE_HOME=/usr/local/java/jre

CLASSPATH=.:$JAVA_HOME/lib:/dt.jar:$JAVA_HOME/lib/tools.jar

PATH=$PATH:$JAVA_HOME/bin

[root@localhost local] # source / etc/profile

[root@localhost local] # chmod + x / etc/rc.local

[root@localhost local] # vim / etc/rc.local

Source / etc/profile / / add this line

Method 2:

Just put the java.sh into / etc/profile.d/, and restart the system.

[root@localhost local] # vim / etc/profile.d/java.sh

Export JAVA_HOME=/usr/local/java

Export JRE_HOME=$ {JAVA_HOME} / jre

Export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

Export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH

[root@centos7 ~] # java-version / / check the java version and test whether the JDK is configured successfully

Java version "1.8.0,171"

Java (TM) SE Runtime Environment (build 1.8.0_171-b11)

Java HotSpot (TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

Configure parameters related to limit

[root@localhost local] # vim / etc/security/limits.conf

Add the following

* soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096

Ulimit-u 4096

[root@localhost local] vim / etc/security/limits.d/20-nproc.conf

Modify the following:

* soft nproc 1024 # modified to * soft nproc 2048 or soft nproc 4096 (minimum is 2048 according to CPU)

# vim / etc/sysctl.conf

/ / add the following configuration: v

M.max_map_count=655360

/ and execute the command:

# sysctl-p

Edit elasticsearch profile

# vim usr/local/elasticsearch-5.6.0/config/elasticsearch.yml

Cluster.name: nmtx-cluster

Node.name: node-1

Path.data: / usr/local/elk/data

Path.logs: / usr/local/elk/logs

Network.host: 192.168.3.104

Http.port: 9200

Create a user running ELK

[root@localhost local] # groupadd elk

[root@localhost local] # useradd-g elk elk

Create an ELK run directory

[root@localhost local] # mkdir-p / usr/local/elk

[root@localhost local] # chown-R elk:elk / usr/local/elk

Turn off the firewall:

[root@localhost] # iptables-F

All of the above is done by root users

3. Install ELK

The following actions are performed by elk users

Log in to the server as elk user

Download the ELK installation package: https://www.elastic.co/downloads, upload it to the server and extract it. Decompress command: tar-xzvf package name

Configure Elasticsearch

Modify the following:

Save exit

Start Elasticsearch

Check to see if the startup is successful

Visit http://192.168.10.169:9200 with a browser

Elasticsearch installation completed

Vi / etc/security/limits.conf

/ / add the following:

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096

Question 3: max number of threads [1024] for user [lish] likely too low, increase to at least [2048]

Solution: switch to the root user and go to the limits.d directory to modify the configuration file.

Vi / etc/security/limits.d/90-nproc.conf

/ / modify the following:

* soft nproc 1024 # modified to * soft nproc 2048

Question 4: max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

Solution: switch to root user to modify configuration sysctl.conf

Vi / etc/sysctl.conf

/ / add the following configuration:

Vm.max_map_count=655360

/ and execute the command:

Sysctl-p then restart elasticsearch to start successfully.

4. Test, the following indicates that elasticsearch was started successfully.

[root@centos7 local] # curl http://127.0.0.1:9200

{

"name": "pcncnlr"

"cluster_name": "elasticsearch"

"cluster_uuid": "uCqIPKYqT_au90cjmtj1rw"

"version": {

"number": "6.3.1"

"build_flavor": "default"

"build_type": "tar"

"build_hash": "eb782d0"

"build_date": "2018-06-29T21:59:26.107521Z"

"build_snapshot": false

"lucene_version": "7.3.1"

"minimum_wire_compatibility_version": "5.6.0"

"minimum_index_compatibility_version": "5.0.0"

}

"tagline": "You Know, for Search"

}

Thank you for reading, the above is the "Centos7 installation and configuration of JDK and ElasticSearch steps" of the content, after the study of this article, I believe you on the Centos7 installation and configuration of JDK and ElasticSearch steps of this problem has a deeper understanding, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report