# 添加新用户 useradd elsearch # 创建一个目录,存放下载的软件 mkdir /itcast cd /itcast mkdir es # 将软件安装到这个目录
chown elsearch:elsearch /itcast/ -R # 进入,然后通过xftp工具,将刚刚下载的文件拖动到该目录下 cd /soft
# 解压缩 tar -zxvf elasticsearch-7.15.0-linux-x86_64.tar.gz -C es
vi config/elasticsearch.yml network.host: 192.168.0.1 #0.0.0.0
#在Elasticsearch中如果,network.host不是localhost或者127.0.0.1的话,就会认为是生产环境,会对环境的要求比较高,我们的测试环境不一定能够满足,一般情况下需要修改2处配置,如下: vi config/jvm.options -Xms256m # 内存128M,根据机器修改 -Xmx256m
vi /etc/sysctl.conf # root用户操作 vm.max_map_count=655360 sysctl -p # root用户下,使生效
su - elsearch # 切换用户 cd bin ./elasticsearch 或 ./elasticsearch -d #后台系统
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# 报错一: bootstrap check failure [1] of [2]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535] ## 解决方法 vi /etc/security/limits.conf # root用户修改,且用户退出后重新登录生效 * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 65535 # 报错二: bootstrap check failure [2] of [2]: 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 ERROR: Elasticsearch did not exit normally - check the logs at /itcast/es/elasticsearch-7.15.0/logs/elasticsearch.log ## 解决方法 vi config/elasticsearch.yml # 取消注释,并保留一个节点 node.name: node-1 cluster.initial_master_nodes: ["node-1]