elasticsearch安装使用

elasticsearch是支持Linux和window系统的,elasticsearch官网上最新的稳定版本是6,2,4,该版本不支持jdk8以下的,所以需要在你的系统下安装好jdk。
安装步骤:

1、下载elasticsearch的rpm包:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-x86_64.rpm

2. 安装elasticsearch

rpm install -y elasticsearch-7.4.2-x86_64.rpm

3. 启动

systemctl start elasticsearch
或者
/etc/init.d/elasticsearch start

4. 验证是否启动

运行
curl http://localhost:9200/
在PowerShell运行
Invoke-RestMethod http://localhost:9200

5.配置elasticsearch

[root@linux-node1 elasticsearch]# grep '^[a-Z]' /etc/elasticsearch/elasticsearch.yml
cluster.name: elk-cluster1 #集群名称
path.data: /elk/data/ # 配置路径
path.logs: /elk/logs/
node.name: elk-node1 #节点名称
network.host: 192.168.1.1 #配置本地IP地址获域名
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.1.1", "192.168.1.2"] #配置广播范围

6. 配置路径 问题解决

mkdir /elk
chown elasticsearch.elasticsearch /elk 给elk目录授权给elasticsearch
重启 systemctl restart elasticsearch

elasticsearch-head 配置使用

git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start & or grunt server &
open http://localhost:9100/

配置elasticsearch 允许elasticsearch-head连接elasticsearch

http.cors.enabled: true   # 开启http访问
http.cors.allow-origin: “*” # 可访问的IP地址

elasticsearch内存优化

查看elasticsearch状态

[root@linux-node1 ~]# ps -ef |grep elasticsearch
elastic+ 3964 1 2 10:58 ? 00:00:53 /bin/java -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+Us
eCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissi
onsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdo
wnHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/usr/share/elasticsearch -cp
/usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -p /var/run/elasticsearch/elasticsearch.pid --quiet -Edefault.path.logs=
/var/log/elasticsearch -Edefault.path.data=/var/lib/elasticsearch -Edefault.path.conf=/etc/elasticsearch
root 4083 1539 0 11:40 pts/0 00:00:00 grep --color=auto elasticsearch

可以看到elasticsearch可使用的最小和最大内存都是2G

官方文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html

修改启动脚本

vim /usr/lib/systemd/system/elasticsearch.service
# 最下面添加
LimitMEMLOCK=infinity systemctl daemon-reload
systemctl restart elasticsearch

修改elastic配置文件锁定内存,这样在后期数据量比较大的时候,运行速度会比较快

vim /etc/elasticsearch/elasticsearch.yml

bootstrap.memory_lock: true

更改jvm.options 根据自己电脑的配置增加运行内存  最大32G

vim /etc/elasticsearch/jvm.options

# add code

-Xms3g
-Xmx3g

获取节点状态值

curl -sXGET http://192.168.56.12:9200/_cluster/health?pretty=true

使用脚本获取节点状态值  然后可以和zabbix结合报警

import json
import subprocess
false = "false"
obj = subprocess.Popen(("curl -sXGET http://192.168.56.12:9200/_cluster/health?pretty=true"),shell=True,st
dout=subprocess.PIPE)
data = obj.stdout.read()
data1 = json.loads(data)
status=data1.get("status")
if status == "green":
print("")
else:
print("")

ElasticSearch及其插件安装配置的更多相关文章

  1. ELK 学习笔记之 elasticsearch head插件安装

    elasticsearch head插件安装: 准备工作: 安装nodejs和npm https://nodejs.org/en/download/ node-v6.11.2-linux-x64.ta ...

  2. Elasticsearch入门教程(一):Elasticsearch及插件安装

    原文:Elasticsearch入门教程(一):Elasticsearch及插件安装 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:h ...

  3. 谷歌浏览器 插件安装配置Momentum chrome

    总之一句话就是这个Momentum插件可以把你的谷歌弄的漂亮一些,来搞一波 下载地址 http://www.cnplugins.com/down/predownnew.aspx?id=33842 下载 ...

  4. ElasticSearch head 插件安装

    head 客户端可以很方便在上面创建索引,类型,文档,还有查询,使用它管理elasticsearch 提高效率. 在安装head 客户端之前必须安装node.js 环境,因为它是用node.js 编写 ...

  5. Elasticsearch 监控插件安装(elasticsearch-head与Kibana)

    摘要 安装Elasticsearch插件Head与Kibana 版本 elasticsearch版本: elasticsearch-2.3.4 elasticsearch-head版本: 2.x(支持 ...

  6. ElasticSearch集群安装配置

    1. 环境说明 Cent OS 7 jdk-8u121-linux-x64.tar.gz elasticsearch-5.2.1.zip 2. 系统环境配置 新建进程用户 修改File Descrip ...

  7. sbt 以及 IDEA sbt 插件安装配置教程(转)

    1. 在Windows中安装sbt 下载 官网: http://www.scala-sbt.org/ github: https://github.com/sbt/sbt/releases/downl ...

  8. Elasticsearch安装(四), elasticsearch head 插件安装和使用。

    安装方式如下: 一.安装Elasticsearch-Head 1.插件安装方式(推荐) #在Elasticsearch目录下 $/bin/plugin -install mobz/elasticsea ...

  9. ElasticSearch head插件安装与配置

    下载 下载地址:https://github.com/mobz/elasticsearch-head 安装 1. 下载到本地 git clone 2. 安装 grunt npm install -g ...

随机推荐

  1. JQuery里input属性赋值,取值prop()和attr()方法?

    一.赋值的时候 如果是<input type="checkbox" checked>这样的只有属性名就能生效的属性 推荐prop,即:$('input').prop(' ...

  2. PimaIndiansdiabetes-数据预处理实验(一)

    有趣的事,Python永远不会缺席! 如需转发,请注明出处:小婷儿的python https://www.cnblogs.com/xxtalhr/p/10859517.html 链接:https:// ...

  3. Android NDK 学习之Application.mk

    Application.mk file syntax specification Introduction: This document describes the syntax of Applica ...

  4. cocos creator按钮点击按钮弹起效果设置方法

    如图所示: 只要设置下button的Transition的属性为Scale即可,参数自己调整下.

  5. mysql存储过程事务

    之前在写一个存储过程的时候由于不仔细导致数据库锁死,这里反省一下. 存储过程是这样的:把数据按顺序插入三张表,如果其中任何一处出错,就把前面已经做了的操作进行回滚,存储过程里面是用事务实现的,我是这么 ...

  6. LNMP环境搭建之编译安装指南(php-5.3.27.tar.gz)

    测试环境:CentOS release 6.5 (Final) 软件安装:nginx   mysql-5.5.32-linux2.6-x86_64.tar.gz   php-5.3.27.tar.gz ...

  7. 安装xshell、xftp

    1.Xshell的软件的下载.安装 xshell是一个终端模拟软件,而且是远程近程都可以. 就是模拟服务器所在的linux,在xshell中可以输入命令, 就像在服务器的linux中输入命令一样.一般 ...

  8. 微信APP支付(基于Java实现微信APP支付)

    步骤: 导入maven依赖 <!--微信支付--> <dependency> <groupId>com.github.wxpay</groupId> & ...

  9. Linux命令——uptime

    参考:linux中uptime命令查看linux系统负载 Linux uptime command 简介 uptim告诉你系统运行了多长时间.uptime命令提供单行显示的输出,包含如下信息: 当前时 ...

  10. 静态库 VS 动态库

    如何得到库 ①先写好一堆的.c文件(.c:我们所需要的各种工具函数) ②将这些.c编译为对应的.o ③将所有的这些.o打包为一个仓库文件(静态库或者动态库) 静态库:按照静态库的方式打包 动态库:按照 ...