安装部署elasticsearch

环境准备:

服务器: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)浏览器访问验证:

原文地址:http://blog.51cto.com/10950710/2123877

时间: 2024-07-30 14:59:02

安装部署elasticsearch的相关文章

Elasticsearch介绍及安装部署

本节内容: Elasticsearch介绍 Elasticsearch集群安装部署 Elasticsearch优化 安装插件:中文分词器ik 一.Elasticsearch介绍 Elasticsearch是一个分布式搜索服务,提供Restful API,底层基于Lucene,采用多shard的方式保证数据安全,并且提供自动resharding的功能,加之github等大型的站点也采用 Elasticsearch作为其搜索服务. 二.Elasticsearch集群安装部署 1. 环境信息 主机名

Kibana+Logstash+Elasticsearch+Redis安装部署

最近做日志分析,发现logstash较符合自己的需求, Logstash:做系统log收集,转载的工具.同时集成各类日志插件,对日志查询和分析的效率有很大的帮助.一般使用shipper作为log收集.indexer作为log转载. Logstash shipper收集log 并将log转发给redis 存储 Logstash indexer从redis中读取数据并转发给elasticsearch redis:是一个db,logstash shipper将log转发到redis数据库中存储.Log

ElasticSearch集群安装部署

0 集群搭建 1.安装unzip yum install unzip2.所有集群节点创建新用户 useradd el3.所有集群节点给el用户设置密码passwd el方便记忆使用的rootroot4.所有集群节点创建安装目录和赋予使用权限-->并转换用户 mkdir -p /opt/es ll /opt/ chown el:el /opt/es ll /opt/ su el 5.上传安装部署包到master6.解压到刚刚创建的目录unzip elasticsearch-2.2.1.zip -d

ELK部署logstash安装部署及应用(二)

Logstash 安装部署注意事项: Logstash基本概念: logstash收集日志基本流程: input-->codec-->filter-->codec-->output input:从哪里收集日志. filter:发出去前进行过滤 output:输出至Elasticsearch或Redis消息队列 codec:输出至前台,方便边实践边测试 数据量不大日志按照月来进行收集 如果通过logstash来采集日志,那么每个客户端都需要安装logstash 安装需要前置系统环境

ElasticSearch2.2 集群安装部署

一.ElasticSearch 集群安装部署 环境准备 ubuntu虚拟机2台 ip:192.168.1.104 192.168.1.106 jdk:最低要求1.7,本机jdk版本1.7_67 安装 a.安装jdk(这里不赘述) b.从官网下载ES版本 地址https://www.elastic.co/downloads/elasticsearch c.解压ES到本地 d.进入config目录下,用编辑器打开elasticsearch.yml文件 1.cluster.name: ppscore-

Kafka介绍及安装部署

本节内容: 消息中间件 消息中间件特点 消息中间件的传递模型 Kafka介绍 安装部署Kafka集群 安装Yahoo kafka manager kafka-manager添加kafka cluster 一.消息中间件 消息中间件是在消息的传输过程中保存消息的容器.消息中间件在将消息从消息生产者到消费者时充当中间人的作用.队列的主要目的是提供路由并保证消息的传送:如果发送消息时接收者不可用,消息对列会保留消息,直到可以成功地传递它为止,当然,消息队列保存消息也是有期限的. 二.消息中间件特点 1

Storm笔记整理(三):Storm集群安装部署与Topology作业提交

[TOC] Storm分布式集群安装部署 概述 Storm集群表面类似Hadoop集群.但在Hadoop上你运行的是"MapReduce jobs",在Storm上你运行的是"topologies"."Jobs"和"topologies"是大不同的,一个关键不同是一个MapReduce的Job最终会结束,而一个topology永远处理消息(或直到你kill它). Storm集群有两种节点:控制(master)节点和工作者(wo

Docker 简单部署 ElasticSearch

一.ElasticSearch是什么? Elasticsearch也使用Java开发并使用Lucene作为其核心来实现所有索引和搜索的功能,但是它的目的是通过简单的RESTful API来隐藏Lucene的复杂性,从而让全文搜索变得简单. 不过,Elasticsearch不仅仅是Lucene和全文搜索,我们还能这样去描述它: 分布式的实时文件存储,每个字段都被索引并可被搜索 分布式的实时分析搜索引擎 可以扩展到上百台服务器,处理PB级结构化或非结构化数据 二.Docker 部署 ElasticS

【原创】大数据基础之Ambari(2)通过Ambari部署ElasticSearch

ambari的hdp中原生不支持elasticsearch安装,下面介绍如何通过mpack方式使ambari支持elasticsearch安装 安装过程 1 下载 Mpack include version 6.3.2 of ElasticSearch, Logstash, Kibana, FileBeat, and MetricBeat # wget https://community.hortonworks.com/storage/attachments/87416-elasticsearc