一、安装elasticsearch
- 安装java
安装Oracle Java,不使用yum安装openjava
- 安装elasticSearch
- 下载elasticSearch压缩包
从官网https://www.elastic.co/cn/downloads/elasticsearch,下载最新版安装包
- 解压到/usr/local/
tar -zxvf elasticsearch-7.5.0-linux-x86_64.tar.gz -C /usr/local/
- 修改配置文件
①network.host: 192.168.161.12
②http.port: 9200
//配置①②就可以在浏览器使用http://192.168.161.12:9200/来访问elasticsearch
③node.name: 192.168.161.12 # 是descriptive name ,可以随便取
④cluster.initial_master_nodes: [192.168.161.12] ##这里填node-name配置的值
③④配置可以解决报错:the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
- 创建testuser用户
Elasticsearch 要求不能使用超级用户root运行,所以我们建立一个testuser账号。
1创建testuser账户
adduser testuser
2 修改密码
passwd testuser
3给testuser用户elasticsearch目录的授权。
chown -R testuser /usr/local/elasticsearch-7.5.0/
4切换至elasticsearch目录,并以testuser用户运行
cd /usr/local/ elasticsearch-7.5.0/
su testuser
./bin/elasticsearch –d
## -d 表示后台运行
5)问题
1max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
解决办法:
切换到root用户,
vi /etc/security/limits.conf ,在文件的最后追加如下配置
testuser soft nofile 65536
testuser hard nofile 65536
其中,soft nofile表示软限制,hard nofile表示硬限制。以上配置表示将testuser用户的软限制为65536,硬限制为65536,
即表示testuser用户能打开的最大文件数量为65536,不管它开启多少个shell。
硬限制是严格的设定,必定不能超过这个设定的数值。
软限制是警告的设定,可以超过这个设定的值,但是若超过,则有警告信息。
重新登录testuser用户,使配置生效
查看当前用户的软限制:
ulimit –Sn 等价于ulimit –n 等价于 ulimit -S –n
查看当前用户的硬限制:
ulimit –Hn 等价于ulimit –H –n
2 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决办法:
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=262144
并执行命令, 使修改立即生效:
sysctl –p
二、安装kibana
1、下载
从官网https://www.elastic.co/cn/downloads/kibana, 下载压缩包
2)解压
tar -xzvf kibana-7.5.0-linux-x86_64.tar.gz -C /usr/local/
3)编辑配置文件
进入kibana所在目录
cd /usr/local/kibana
vi config/kibana.yml
编辑以下内容:
1server.port: 5601
2server.host: "192.168.161.12" ##不能配置为localhost,否则其他主机无法访问
3elasticsearch.url: http://127.0.0.1:9200
4)启动
#不能关闭终端
./bin/kibana
#可关闭终端
nohup ./bin/kibana &