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

How to build and configure elasticsearch?

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

Share

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

Construction and configuration of ELK

1. Add new disks on the two machines, format them, mount them, and use them exclusively for ELK.

Mkfs.xfs / dev/sdb

Mkdir / data1

Mount / dev/sdb / data1

Blkid / dev/sdb # queries the uuid of the disk and mounts it using uuid to prevent the disk name from changing when the server is restarted

Vim / etc/fstab

Dd86fef0-3873-4767-bc9a-dc673dcecb5a / data1 xfs defaults 0 0

2. Download the installation package

Https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.0.rpm

Http://download.oracle.com/otn/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm?AuthParam=1527560278_371b883a1f5d9c8b5944edcb464b5780

Installation

Yum install jdk-8u121-linux-x64.rpm

Yum install elasticsearch-5.4.0.rpm

3. Set the hostname and local hosts file

Hostnamectl set-hostname elk01.example.com

Hostnamectl set-hostname elk02.example.com

Cat / etc/hosts

10.1.2.184 elk01.example.com

10.1.2.186 elk02.example.com

4. Turn off the firewall and selinux and the number of files opened

Systemctl disable firewalld

Systemctl disable NetworkManager

Sed-I'/ SELINUX/s/enforcing/disabled/' / etc/selinux/config

Echo "soft nofile 65536" > > / etc/security/limits.conf

Echo "hard nofile 65536" > > / etc/security/limits.conf

5. Set the yun source and install the necessary packages

Yum install-y net-tools vim lrzsz tree screen lsof tcpdump wget ntpdate

6. Configure elasticseach configuration file

Grep "^ [a Merz]" / etc/elasticsearch/elasticsearch.yml

Cluster.name: elk-cluster

Node.name: elk-node-1

Path.data: / data1/elkdata

Path.logs: / data1/logs

Bootstrap.memory_lock: true

Network.host: 10.1.2.184

Http.port: 9200

Discovery.zen.ping.unicast.hosts: ["10.1.2.184", "10.1.2.186"]

7. Create a directory, modify permissions, and start

Mkdir / data1/ {elkdata,logs}

Chown-R elasticsearch.elasticsearch / data1/ {elkdata,logs}

8. Modify the memory parameters of the startup script, otherwise it will not start

Vim / usr/lib/systemd/system/elasticsearch.service

Uncomment LimitMEMLOCK=infinity

Vim / etc/elasticsearch/jvm.options # can not be changed, if it can be started

-Xms3g # the recommended memory usage is no more than 50% of physical memory, and a maximum of 32 GB

-Xmx3g

PS: error prompt

Loaded: loaded (/ usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)

Check the jdk version and whether other versions of jdk are originally installed on the system

9. Install the head of the elasticsearch plug-in

Yum install git-core

Git clone git://github.com/mobz/elasticsearch-head.git

Cd elasticsearch-head

Yum install-y npm

Npm install grunt-save

Ll node_modules/grunt confirms the generated file

Npm install

Npm run start & start

10.1.2.189Viru 9100 visit

Test cluster status after installation

Curl http://10.1.2.189:9200/_cluster/health?protty=true

"status": "green", this column is gree is normal

10. Modify the elasticsearch configuration file before you can connect

Http.cors.enabled: true # pay attention to spaces

Http.cors.allow-origin: "*"

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