ELK安装

CenterOS7 安装 Elasticsearch(6.3.1) Kibnan(6.3.1) Logstash(6.3.1)


###1.安装 Elasticsearch ####1.1下载node

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

####1.2解压linux

tar -zxvf elasticsearch-6.3.1.tar.gz

####1.3新建data和logs目录json

先建两个文件夹 
	[root@localhost elasticsearch-6.3.1]# mkdir data
	[root@localhost elasticsearch-6.3.1]# mkdir logs
	先备份一下配置文件
	[root@localhost config]# cp elasticsearch.yml  elasticsearch.yml_bak

####1.4修改配置文件bootstrap

修改配置文件 vi elasticsearch.yml
	cluster.name: my-application
	node.name: node-1
	path.data: /usr/local/elk/elasticsearch-6.3.1/data
	path.logs: /usr/local/elk/elasticsearch-6.3.1/logs
	bootstrap.memory_lock: true
	network.host: 192.168.126.202
	http.port: 9200

####1.5 添加用户及用户组并修改整个es的权限**(es不能用root启动)**浏览器

groupadd search
	useradd -g search  search
	chown -R search.search /usr/local/elk/elasticsearch-6.3.1

####1.6 切换用户并启动安全

su search
	bin/elasticsearch

####1.7 测试是否安装成功app

curl http://192.168.126.202:9200
会有一些json输出,能够用浏览器访问http://192.168.126.202:9200
在外网(虚拟机外)访问不成功的缘由是对应端口没开放
办法1.关闭防火墙或者

办法2.开启对应端口
咱们这里用开启对应端口来解决(安全)
1.查看已经开放的端口:
firewall-cmd --list-ports(没有9200端口)
firewall-cmd --zone=public(做用域) --add-port=9200/tcp(端口和访问类型) --permanent(永久生效)
firewall-cmd --reload
这样外部浏览器就能够访问了

###常见报错curl

1.max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
	[缘由:没法建立本地文件问题,用户最大可建立文件数过小
	解决方案:
	切换到root用户,编辑limits.conf配置文件, 添加相似以下内容:
	vi /etc/security/limits.conf
	添加以下内容:
	* soft nofile 65536
	* hard nofile 131072
	* soft nproc 2048
	* hard nproc 4096
	备注:* 表明Linux全部用户名称(好比 hadoop)
	保存、退出、从新登陆才可生效
2.memory locking requested for elasticsearch process but memory is not locked
	缘由:锁定内存失败
	解决方案: 
	切换到root用户,编辑limits.conf配置文件, 添加相似以下内容: 
	vi /etc/security/limits.conf
	添加以下内容: 
	* soft memlock unlimited 
	* hard memlock unlimited
3.max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
	max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
	缘由:最大虚拟内存过小
	解决方案:切换到root用户下,修改配置文件sysctl.conf
	vi /etc/sysctl.conf
	添加下面配置:
	vm.max_map_count=655360
	并执行命令:
	sysctl -p
	而后从新启动elasticsearch,便可启动成功。

###安装kibana ####1.下载elasticsearch

wget https://artifacts.elastic.co/downloads/kibana/kibana-6.3.1-linux-x86_64.tar.gz

####2.解压tcp

tar -zxvf  kibana-6.3.1-linux-x86_64.tar.gz

####3.备份配置文件

[root@localhost config]# cp kibana.yml kibana.yml_bak
	[root@localhost config]# vi kibana.yml
	server.port: 5601
	server.host: "192.168.126.202"
	elasticsearch.url: "http://192.168.126.202:9200"

####4.启动

bin/kibana

####5.开启对应端口

firewall-cmd --add-port=5601/tcp

####6.测试是否安装成功浏览器访问

http://192.168.126.202:5601
	会有kibana界面

###1.安装 logstash

wget https://artifacts.elastic.co/downloads/logstash/logstash-6.3.1.tar.gz

####2.解压 tar -zxvf logstash-6.3.1.tar.gz ####3.启动

./bin/logstash -e 'input { stdin{} } output { stdout {} }'
相关文章
相关标签/搜索