centos7.4安装elasticsearch6.1.3集群部署

author author     2022-10-25     490

关键词:

Centos7.4 安装elasticsearch6.1.3集群部署


安装elasticsearch


1.依赖环境安装

这里使用的java 是1.8.0_77的版本.使用的是rpm 安装包的形式进行部署安装 。

配置环境变量


[[email protected] ~]# cat .bash_profile
export JAVA_HOME=/usr/java/jdk1.8.0_77/                     # JAVA_HOME变两个路径
export JAVA_BIN=/usr/java/jdk1.8.0_77/bin
export PATH=$JAVA_HOMEbin:$PATH

检测java环境安装是否正常


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


2.elasticsearch使用的是6.1.3版本。elasticsearch-6.1.3.tar.gz


[[email protected] local]# tar -zxvf elasticsearch-6.1.3.tar.gz  
[[email protected] local]# ls
bin  elasticsearch-6.1.3  elasticsearch-6.1.3.tar.gz  etc  games  include  lib  lib64  libexec  sbin  share  src

修改配置文件


node1
[[email protected] local]# cd   node1/config/
[[email protected] config]# cat elasticsearch.yml | grep -v "^#"
cluster.name: elasticsearch #集群的名称
node.name: node1   #节点的名称
bootstrap.memory_lock: false #另一种选择是在Linux / Unix系统上使用mlockall或在Windows上使用            VirtualLock,以尝试将进程地址空间锁定到RAM中,防止任何Elasticsearch           内存被换出。
bootstrap.system_call_filter: false #为禁用系统调用过滤器false
network.host: 133.1.11.39   #绑定到回送地址

http.port: 9200    #设置对外服务的http端口,默认为9200
discovery.zen.ping.unicast.hosts: ["133.1.11.39","133.1.11.39:9202","133.1.11.39:9203"]
discovery.zen.minimum_master_nodes: 2


node2
cluster.name: elasticsearch
node.name: node2
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 133.1.11.39

http.port: 9202
discovery.zen.ping.unicast.hosts: ["133.1.11.39","133.1.11.39:9202","133.1.11.39:9203"]
discovery.zen.minimum_master_nodes: 2

node3
cluster.name: elasticsearch
node.name: node3
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 133.1.11.39

http.port: 9203
discovery.zen.ping.unicast.hosts: ["133.1.11.39","133.1.11.39:9202","133.1.11.39:9203"]
discovery.zen.minimum_master_nodes: 2


[[email protected] config]# vim jvm.options 
-Xms512m
-Xmx512m


3.需要修改的配置参数

vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

vim /etc/security/limits.d/90-nproc.conf
* soft nproc 2048

vim /etc/sysctl.conf
vm.max_map_count=655360
sysctl -p

 

4.启动elasticsearch 不能使用root 用户需要进行创建用户

[[email protected] ~]# groupadd es
[[email protected] ~]# useradd es -g es -p es
[[email protected] ~]# chown -R es:es /usr/local/node1


启动elasticsearch


[[email protected] bin]# ./elasticsearch -d


5.进行访问测试


[[email protected] bin]# curl  http://133.1.11.39:9200

 "name" : "node1",
 "cluster_name" : "elasticsearch",
 "cluster_uuid" : "dJo2cKFfSO-M-qwMF9upjg",
 "version" :
   "number" : "6.1.3",
   "build_hash" : "af51318",
   "build_date" : "2018-01-26T18:22:55.523Z",
   "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"



安装head 插件


1.安装NodeJS


[[email protected] ~]# wget https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.5.0-linux-x64.tar.gz
[[email protected] ~]#tar -zxvf  node-v4.5.0-linux-x64.tar.gz -C /usr/local

配置环境变量
export NODE_HOME=/usr/local/node-v4.5.0-linux-x64
export PATH=$PATH:$NODE_HOME/bin/
export NODE_PATH=$NODE_HOME/lib/node_modules
[[email protected] ~]#source /etc/profile

2.安装npm


[[email protected] ~]#  npm install -g cnpm --registry=https://registry.npm.taobao.org

3.使用npm安装grunt


/usr/local/node-v4.5.0-linux-x64/bin/grunt -> /usr/local/node-v4.5.0-linux-x64/lib/node_modules/grunt/bin/grunt
[email protected] /usr/local/node-v4.5.0-linux-x64/lib/node_modules/grunt
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected])

[[email protected] ~]#  npm install -g grunt-cli --registry=https://registry.npm.taobao.org --no-proxy
/usr/local/node-v4.5.0-linux-x64/bin/grunt -> /usr/local/node-v4.5.0-linux-x64/lib/node_modules/grunt-cli/bin/grunt
[email protected] /usr/local/node-v4.5.0-linux-x64/lib/node_modules/grunt-cli
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
└── [email protected] ([email protected]

4.版本确认


[[email protected] ~]# node -v
v4.5.0
[[email protected] ~]# npm -v
2.15.9
[[email protected] ~]#  grunt -version
grunt-cli v1.2.0

5.下载head插件源码


[[email protected] ~]#  wget https://github.com/mobz/elasticsearch-head/archive/master.zip
[[email protected] ~]# unzip master.zip  -d /usr/local/

6.下载依赖

[[email protected] elasticsearch-head-master]# npm install -g grunt-cli 
/usr/local/node-v4.5.0-linux-x64/bin/grunt -> /usr/local/node-v4.5.0-linux-x64/lib/node_modules/grunt-cli/bin/grunt
[email protected] /usr/local/node-v4.5.0-linux-x64/lib/node_modules/grunt-cli
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected])


[[email protected] elasticsearch-head-master]#  grunt -version
grunt-cli v1.2.0
[[email protected] elasticsearch-head-master]# npm install

二. 配置ElasticSearch

停止ElasticSearch


[[email protected] local]# jps
28516 Jps
12072 Elasticsearch

1.配置 ElasticSearch,使得HTTP对外提供服务

node1 上面配置
[[email protected] ]# vim config/elasticsearch.yml
# 增加新的参数,这样head插件可以访问es。设置参数的时候:后面要有空格
http.cors.enabled: true
http.cors.allow-origin: "*"

2.修改head插件配置文件


[[email protected] elasticsearch-head-master]# vim Gruntfile.js
connect:
                       server:
                               options:
                                       hostname: '0.0.0.0',
                                       port: 9100,
                                       base: '.',
                                       keepalive: true
                               
                       
               
  修改修改连接地址:_site/app.js
[[email protected] elasticsearch-head-master]# vim _site/app.js
   _node_handler: function(data)
                       if(data)
//                              this.prefs.set("app-base_uri", this.cluster.base_uri);
                               this.prefs.set("app-base_uri" )|| "http://133.1.11.39:9200";
                               if(data.version && data.version.number)
                                       this.cluster.setVersion(data.version.number);

3.启动elasticsearch,head


[[email protected] bin]# ./elasticsearch -d #分别启动3个节点
[[email protected] elasticsearch-head-master]# nohup  grunt  server &

4.注意坑


如果出现集群无法链接
请注意删除node1 下面/usr/local/node1/data 下面的目录,不然造成数据不统一 不能呢链接head 插件




elasticsearch6windows安装

前言目前使用ElasticSearch6.2最新版本,这里记录其在windows2012R2系统上的安装步骤。安装1.安装java,最新版本的ElasticSearch需要java8版本,因此需要先去Oracle官网下载jdk,下载之后就直接安装: 2安装过程中将其安装目录copy下来... 查看详情

elasticsearch6.0安装

ELKStack简介       对于日志来说,最常见的需求就是收集、存储、查询、展示,开源社区正好有相对应的开源项目:logstash(收集)、elasticsearch(存储+搜索)、kibana(展示),我们将这三个组合起来的技... 查看详情

elasticsearch6.0及其head插件安装

Elasticsearch6.0及其head插件安装1.下载并解压elasticsearch2.修改elasticsearch.yml文件#集群的名字cluster.name:my-application#节点名字node.name:node-1#数据存储目录(多个路径用逗号分隔)path.data:/home/wjy/es/data#日志目录path.logs:/home/wjy/es/logs 查看详情

(新)elasticsearch6.0版本安装head插件

...件都比较**,mysql和elasticsearch新版本变动都比较大。 elasticsearch6.0貌似已经不支持命令行安装head插件了,反正我是折腾了一下午才得出这个结论的。因此,如果你还想安装head,只能选择手动下载安装。(别再纠结于命令行安... 查看详情

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

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

elasticsearch6.6.1安装部署

1.下载安装包https://www.elastic.co/cn/downloads/elasticsearch我下的是Linux环境的tar包2.解压安装包tar-xvf elasticsearch-6.1.1.tar.gz3.启动命令切换普通用户,进入bin目录启动./elasticsearch或./elasticsearch-d(守护进程)4.如果有报错按照下面方法... 查看详情

elk之elasticsearch6安装认证模块searchguard

  参考:https://www.cnblogs.com/marility/p/9392645.html  1,安装环境及软件版本程序  版本安装方式          查看详情

elasticsearch6.0及其head插件安装(代码片段)

Elasticsearch6.0及其head插件安装1.下载并解压elasticsearch2.修改elasticsearch.yml文件#集群的名字cluster.name:my-application#节点名字node.name:node-1#数据存储目录(多个路径用逗号分隔)path.data:/home/wjy/es/data#日志目录path.logs:/home/wjy/es/logs 查看详情

阿里云centos7.4安装nexus

阿里云centos7.4安装nexus威先生2018关注2019.03.2319:41:43字数390阅读473准备材料系统:centos7.4、nexus-2.11.2-03、jdk1.8(跳过讲解安装)nexus-2.11.2-03下载地址方式:方式一:https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.11.2- 查看详情

windows平台为elasticsearch6.x安装head客户端插件(代码片段)

...境(之前的直接用plugin命令即可安装)。操作步骤1.安装ElasticSearch6.x,访问http://localhost:9200/查看是否安装成功。2.安装Node,使用node-v查看是否安装成功。3.在Node中执行npminstall-ggrunt-cli安装grunt,使用grunt-version查看是否安装成功 查看详情

centos7.4安装yumzabbix3.4(代码片段)

DownloadandinstallZabbixhttps://www.zabbix.com/download安装安装mariadbyuminstallmariadb-servermariadb–ysystemctlenablemariadbsystemctlrestartmariadb安装Zabbix3.4rpm-ivhhttp://repo.zabbix.com/zabbix/3.4/rhel 查看详情

windows下安装elasticsearch6.2.4(代码片段)

window下安装 elasticsearch一、环境搭建需要的环境1、jdk环境2、Elasticsearch3、git环境4、node 安装包  二、进行环境的搭建1、解压Elasticsearch的压缩包2、window下进入bin目录下,打开elasticsearch.bat文件3、此时说明Elasticsearch&... 查看详情

centos7安装elasticsearch6.5.4

因为ElasticSearch是基于Lucene的分布式搜索引擎,Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,所以需要先在你的环境中安装jre环境。具体可以参考这篇文章Centos7安装和配置jre1.8。第一步,下载ElasticSearchhttps:/... 查看详情

centos7.4_64位系统安装指南

小土豆Linux学习随笔——清听凌雪慕忆1.范围1.1标识CentOS7.464位系统安装指南1.2文档概述主要介绍CentOS7.464位系统安装流程。2.安装环境支持CentOS7.464位操作系统的服务器或其他X86体系硬件。3.安装步骤光盘、U盘启动本文来自博客园... 查看详情

centos7.4系统的安装

...操作系统前的准备:需要准备以下软件:Vmwareworkstation12Centos7.4系统镜像安装:新建虚拟机向导,选择自定义高级:选择虚拟机硬件兼容性选择要安装操作系统镜像:选择要安装操作系统的类型下一步命名虚拟机并选择虚拟机存放... 查看详情

centos7.4安装samba服务(代码片段)

centos7.4安装samba服务系统平台CentOSLinuxrelease7.4.1708(Core)关闭防火墙,selinux安装samba-4.6.2-8.el7.x86_64samba-client-4.6.2-8.el7.x86_64配置/etc/samba/smb.conf创建共享目录,本地目录权限和共享权限创建系统用户与共享用户的密码启动smb.service客户... 查看详情

centos7.4安装gitlab(代码片段)

1.安装依赖软件yum-yinstallpolicycoreutilsopenssh-serveropenssh-clientspostfix2.下载gitlab安装包,然后安装centos7系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7wgethttps://mirrors.tuna.tsinghua.edu.cn/g 查看详情

elasticsearch6.3head插件安装(代码片段)

wgethttps://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.4.7-linux-x64.tar.gztar-zxvfnode-v4.4.7-linux-x64.tar.gz#vi/etc/profileNODE_HOME=/usr/local/node-v4.4PATH=$NODE_HOME/bin:$PATHexportNODE_HOM 查看详情