安装
jdk安装
前提 Linux配置jdk8环境 如何安装jdk8
1.去oracle官网下载jdk8 https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html
2.安装解压jdk8 tar -zxvf 你的jdk.gz
3.配置jdk环境 vim /etc/profile
修改profile文件
#java environment
export JAVA_HOME=/opt/jdk1.8.0_301 (注意这里是解压目录)
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
修改完后source /etc/profile
使之生效
以上是JDK环境的配置
4.验证jdk java -version
查看是否有对应 没有的话检查是否配置正确
es的安装
- 下载es的安装包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz
- 解压es安装包
tar -zxvf
(es.gz文件名) - es7版本不能通过root直接启动(安全问题)需要子用户来启动
解决方案 :
添加用户组groupadd es_user
添加用户useradd es_user -g admin
赋予读写权限chown -R admin:es_user elasticsearch-7.3.2
切换到admin su admin
- 配置 vim jvm.options vim elasticsearch.yml
遇到的问题
ERROR: [4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [3795] for user [admin] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: 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
解决:[1] vim /etc/sysctl.conf 添加 vm.max_map_count = 655360
[2] vim /etc/security/limits.conf 添加
* soft nofile 65535
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
# End of file
[3] vim elasticsearch.yml
cluster.name: my-app-es
node.name: node-1
network.host: 192.168.xx.xxx 你的服务器IP
http.port: 9200 端口
cluster.initial_master_nodes: ["node-1"] 集群
访问配置
无法访问注意是否开启防火墙
查看防火墙 firewall -cmd --state
停止防火墙 systemctl stop firewalld.service
启动后访问:
kibana安装
ES集群搭建
一台机器搭建集群
重新选举