安装部署elasticsearch(代码片段)

author author     2022-11-20     317

关键词:

环境准备:

服务器:centos7服务器1台,IP:10.0.0.103
安装包:
elasticsearch-6.1.1.tar.gz
jdk-8u151-linux-x64.tar.gz

[[email protected] ~]# ll
-rw-r--r--  1 root root  33783880 6月   3 11:18 elasticsearch-6.1.1.tar.gz
-rw-r--r--  1 root root 189736377 6月   3 11:23 jdk-8u151-linux-x64.tar.gz
[[email protected] ~]# 

安装JDK

elasticsearch需要依赖JDK,因此首先要安装JDK:
1、解压安装包

[[email protected]?~]#?tar xf jdk-8u151-linux-x64.tar.gz -C /usr/local/

2、安装jdk修改/etc/profile,在文件末尾加入下面几句:

export JAVA_HOME=/usr/local/jdk1.8.0_151   #根据目录和版本修改
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export  PATH=$JAVA_HOME/bin:$PATH

3、source命令让修改后的/etc/profile生效:

[[email protected] ~]# source /etc/profile

4、检查安装正确性:

[[email protected] ~]# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
[[email protected] ~]# 

安装elasticsearch

1、解压文件

[[email protected]?~]#?tar?-xf?elasticsearch-6.1.1.tar.gz?-C /usr/local??##解压
[[email protected]?~]#?cd?/usr/local/elasticsearch-6.1.1
[[email protected]?elasticsearch-6.1.1]#?ls
bin??config??lib??LICENSE.txt??modules??NOTICE.txt??plugins??README.textile

2、修改配置如下(根据实际情况调整)

[[email protected] config]# cat elasticsearch.yml
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: mycluster   #配置ES集群名字
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1  #配置节点名字
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /opt/elk/data     #配置数据路径
#
# Path to log files:
#
path.logs: /opt/elk/logs     #配置日志路径
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 10.0.0.103    ?#配置为本地ip,监听主机
#
# Set a custom port for HTTP:
#
http.port: 9200   #设置对外服务的http端口
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 1    #设置这个参数来保证集群中的节点可以知道其它N个有master资格的节点。默认为1,对于大的集群来说,可以设置大一点的值(2-4)。我这里只有一台,所以设置为1
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

3、修改系统配置文件:
修改之前最好先备份:

[[email protected] elasticsearch-6.1.1]# cp /etc/security/limits.conf  /etc/security/limits.conf.bak
[[email protected] elasticsearch-6.1.1]# cp /etc/sysctl.conf /etc/sysctl.conf.bak

vi /etc/security/limits.conf?
在文件末尾添加如下内容:

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

vi /etc/sysctl.conf?
添加下面配置:

vm.max_map_count=655360

并执行命令sysctl -p让其修改生效:

[[email protected] elasticsearch-6.1.1]# sysctl -p
vm.max_map_count = 655360

4、创建启动elasticsearch的用户和日志目录,修改权限:

[[email protected] elasticsearch-6.1.1]# cd /usr/local
[[email protected] local]# useradd elk
[[email protected] local]# mkdir /opt/elk/logs -p
[[email protected] local]# mkdir /opt/elk/data -p
[[email protected] local]# chown -R elk:elk /opt/elk/
[[email protected] local]# chown -R elk:elk /usr/local/elasticsearch-6.1.1

5、启动服务
[[email protected] config]# su elk
[[email protected] config]$ nohup /usr/local/elasticsearch-6.1.1/bin/elasticsearch >/dev/null 2>&1 &

6、服务验证:
1)查看进程和端口号:

[[email protected] config]# netstat -tlunp|grep 9200
tcp6       0      0 10.0.0.103:9200         :::*                    LISTEN      6665/java           

[[email protected] config]# ps -ef|grep elasticsearch
elk        6665      1  4 15:10 pts/0    00:01:17 /usr/local/jdk1.8.0_151/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/usr/local/elasticsearch-6.1.1 -Des.path.conf=/usr/local/elasticsearch-6.1.1/config -cp /usr/local/elasticsearch-6.1.1/lib/* org.elasticsearch.bootstrap.Elasticsearch
root       6769   3724  0 15:37 pts/0    00:00:00 grep --color=auto elas

2)命令行验证:
[[email protected] config]# curl http://10.0.0.103:9200

"name" : "node-1",
"cluster_name" : "elk",
"cluster_uuid" : "gv8DzvZeR1W-aOM_UTEdVA",
"version" :
"number" : "6.1.1",
"build_hash" : "bd92e7f",
"build_date" : "2017-12-17T20:23:25.338Z",
"build_snapshot" : false,
"lucene_version" : "7.1.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
,
"tagline" : "You Know, for Search"

[[email protected] config]#

3)浏览器访问验证:
技术分享图片

安装部署elasticsearch(代码片段)

环境准备:服务器:centos7服务器1台,IP:10.0.0.103安装包:elasticsearch-6.1.1.tar.gzjdk-8u151-linux-x64.tar.gz[[email protected]~]#ll-rw-r--r--1rootroot337838806月311:18elasticsearch-6.1.1.tar.gz-rw-r--r--1rootroot1 查看详情

elasticsearch的安装部署(代码片段)

https://blog.csdn.net/lubin2016/article/details/81606753 1.elasticsearch的安装1.1集群规划上传elasticsearch的tar.gz包至规划的集群各节点的目录下(规划两个节点rc-fhcb-10-es001,rc-fhcb-10-es002),如:本项目安装在/opt/fhcb/目录下注意:建议elasticse 查看详情

mac下elasticsearch安装部署(代码片段)

...件的支持,且安装方式较简单地址:https://github.com/medcl/elasticsearch-rtf解压到指定目录后,获取该集成包所支持的插件列表bin/elasticsearch-pluginlist删除多余插件这其中,大多数插件一般都用不上的,因此会浪费一些内存空间bin/elastic... 查看详情

elasticsearch5.5安装部署(代码片段)

Elasticsearch5.5下载https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.tar.gzJDK1.8下载http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u18 查看详情

linux12elk-->02elasticsearch部署(代码片段)

文章目录ELKElasticsearch部署ElasticSearch一、ELK部署1、环境准备2、优化3、下载安装包4、设置elastcsearch内存锁定5、修改elastcsearch内存大小6、修复elastcsearch配置文件(单台测试)7、启动服务二、安装集群head插件1、docker安装2... 查看详情

elasticsearch入门简介及部署(代码片段)

Elasticsearch入门(一)简介及部署简介ES存储结构部署准备工作新建用户免密钥修改资源配置ES部署安装单机修改配置分发启动es-head部署配置依赖安装单机修改配置启动IK分词器部署安装单机分发启动简介传统的索引是根据... 查看详情

es实战elasticsearch6.7的安装部署卸载-rpm方式(代码片段)

Elasticsearch6.7的安装部署卸载-RPM方式文章目录Elasticsearch6.7的安装部署卸载-RPM方式环境准备系统调优安装操作错误总结错误一:memlockunlimited错误二:memoryisnotlocked卸载补充知识systemctl常用指令表格RPM包采用系统默认的安装... 查看详情

2022elasticsearch-7.17.6集群部署(代码片段)

目录0.环境系统1.安装es集群2.配置es集群2.1.修改es配置文件2.2.修改JVM配置3.系统配置4.启动es集群0.环境系统1.安装es集群下载及安装wgethttps://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.6-x86_64.rpmwgethttps://artifacts.elastic.co 查看详情

树莓派部署elasticsearch6集群(代码片段)

欢迎访问我的GitHub本篇概览今天在两个树莓派3B上部署了Elasticsearch6.7.1版本的集群,和在一般Linux服务器上部署区别不大,现在把过程小结一下,希望能给您一些参考;环境信息树莓派操作系统是64位Ubuntu,该系统的安装步骤请参... 查看详情

elasticsearch-elasticsearch详解;安装部署(代码片段)

一、结构化、半结构化、非结构化数据在数据分析的过程中,我们会接触到很多的数据,这些数据根据结构分类可划分为三种:结构化数据、非结构化数据和半结构化数据。1、结构化数据结构化数据(简单来说就... 查看详情

elasticsearch6.x集群安装部署(代码片段)

...版本不能低于1.8,推荐使用openjdk软件包版本下载地址elasticsearch6.2.3https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.rpmopenjdk9.0.4https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_linux-x64_bin.tar.gz部署步骤三个节分别安... 查看详情

elasticsearch8.6.2集群安装部署(代码片段)

ElasticSearch8.6.2集群安装部署Elasticsearch是一个分布式、RESTful风格的搜索和数据分析引擎,能够解决不断涌现出的各种用例。作为ElasticStack的核心,Elasticsearch会集中存储您的数据,让您飞快完成搜索,微调相关性... 查看详情

elasticsearch-head部署(代码片段)

 elasticsearch-head是一个elasticsearch集群的web前端。官方文档:https://github.com/mobz/elasticsearch-head在elasticsearch.yml中增加两行配置$tail-2config/elasticsearch.ymlhttp.cors.enabled:truehttp.cors.allow-origin:"*" 下载head并安装,需要先yum安装nodejs,b... 查看详情

elasticsearch集群部署(代码片段)

...1、检索2、如果用MySQL来做关键词检索3、倒排索引ELK简介ElasticSearch集群部署01、集群规划+集群网络配置02、CentOS7创建新用户+免密登录(可选)03、安装JDK04、环境变量(可选)05、ES的下载、上传、解压、修... 查看详情

elk-elasticsearch-6.3.2部署(代码片段)

 参考博客:linux下ElasticSearch.6.2.2集群安装与head、Kibana、X-Pack..插件的配置安装参考博客:ELK5.5.1插件安装实践纪要(head/bigdesk/kopf/cerebo/中文分词插件)参考博客:ELK构建MySQL慢日志收集平台详解参考博客:针对Logstash吞吐量... 查看详情

elasticsearch,filebeat,kibana部署,添加图表及elastalert报警(代码片段)

服务端安装Elasticsearch和Kibana(需要安装openjdk1.8以上)安装方法:https://www.elastic.co以Ubuntu为例:wget-qO-https://artifacts.elastic.co/GPG-KEY-elasticsearch|sudoapt-keyadd-sudoapt-getinstallapt-transport-httpsecho"debh 查看详情

centos7部署elasticsearch8.5(代码片段)

CentOS7部署elasticsearch8.5 elk与jdk依赖关系 https://www.elastic.co/cn/support/matrix  1.下载安装包[root@localhost~]#wgethttps://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.5. 查看详情

elasticsearch8集群搭建安全功能配置详述(代码片段)

ElasticStack产品栈包含Beats、APM、Elasticsearch、ElasticsearchHadoop、Kibana、Logstash,这些产品常被作为一个整体搭配使用,其部署需要使用同样的版本,这样子能够有效简化部署操作。本文主要记录Elasticsearch8.4.3的安装过程,... 查看详情