ElasticSearch学习笔记(一)- 安装

一、ElasticSearch 安装(6.x)

1、下载地址:

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.12.tar.gz

2、新创建一个用户,不可使用root

useradd es         #创建用户es
groupadd es        #创建组es
usermod es -g es  #将用户添加到组
chown -R es:es /opt/ELK/	# 赋予用户权限

3、创建存放数据的目录:

mkdir /opt/ELK/elasticsearch-6.8.12/data

4、elasticsearch.yml 配置文件(单节点)

cluster.name: my-application	# 集群名称
node.name: node-1	#节点名称
path.data: /opt/ELK/elasticsearch-6.8.12/data	# 数据存放目录
path.logs: /opt/ELK/elasticsearch-6.8.12/logs	# 日志存放目录
network.host: 0.0.0.0	#	绑定访问地址
http.port: 9200

5、启动:
http://192.168.23.130:9200/
在这里插入图片描述

会出现的异常:
1. max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

修改/etc/security/limits.conf文件,增加配置,用户退出后重新登录生效

*               soft    nofile          65536
*               hard    nofile          65536
*               soft    nproc           4096
*               hard    nproc           4096

2. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

修改/etc/sysctl.conf文件,增加配置vm.max_map_count=262144
sysctl -p

二、安装header 插件

node下载地址:https://nodejs.org/en/download/

# 解压
tar xvf node*
# 编辑文件
vi /etc/profile
# 添加
export NODE_HOME=/opt/ELK/node-v12.18.3-linux-x64
export PATH=$PATH:$NODE_HOME/bin
export NODE_PATH=$NODE_HOME/lib/node_modules

source /etc/profile
# 查看版本
node -v 
npm -v
npm install -g cnpm --registry=https://registry.npm.taobao.org
npm install -g grunt-cli
npm install grunt --save-dev

安装elasticsearch-head:

git clone git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head/
npm install grunt --save-dev
cnpm install

启动程序

nohup cnpm run start &> run.log &

输入地址:http://192.168.x.x:9100/ 进入界面

如果在界面中显示未连接
在 elasticsearch.yml 文件中 加入以下

http.cors.enabled: true
http.cors.allow-origin: "*"

三、kibana 安装

# 1.下载Kibana
 https://www.elastic.co/downloads/kibana

# 2. 安装下载的kibana
 rpm -ivh kibana-6.2.4-x86_64.rpm

# 3. 查找kibana的安装位置
 find / -name kibana
    
# 4. 编辑kibana配置文件
 [root@localhost /]# vim /etc/kibana/kibana.yml

# 5. 修改如下配置
 server.host: "192.168.202.200"                		#ES服务器主机地址
 elasticsearch.hosts: ["http://192.168.202.200:9200"]   #ES服务器地址

# 6. 启动kibana
    systemctl start kibana
	systemctl stop  kibana
	systemctl status kibana

# 7. 访问kibana的web界面  
  http://10.102.115.3:5601/   #kibana默认端口为5601 使用主机:端口直接访问即可    
  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值