// 创建目录 cd /usr/local/ mkdir es // wget下载 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.1.tar.gz // 解压 tar -zxvf elasticsearch-6.4.2.tar.gz
// 创建用户test useradd test // 为test分配密码test echo "password" |passwd test --test // 为新创建的用户test分配文件权限 chown -R test:test /usr/local/es/elasticsearch-6.6.2 // 验证用户 1. su test 2. 输入密码 3. whoami 4. 查看输出是否是test
4. 使用test用户运行es
1 2
cd /usr/local/es/elasticsearch-6.6.2/bin ./elasticsearch
./elasticsearch -d 是后台运行
5. 可能出现的错误
max file descriptors [4096] for elasticsearch process is too low
1
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
原因:无法创建本地文件问题,用户最大可创建文件数太小解决方案:切到root 用户下
1 2 3 4 5
$ vim /etc/security/limits.conf 在文件的末尾添加下面的参数值: * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
max virtual memory areas vm.max_map_count [65530] is too low
1 2 3 4
ERROR: [1] bootstrap checks failed [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] ... ... [2018-10-30T11:41:51,807][INFO ][o.e.x.m.j.p.NativeController] Native controller process has stopped - no new native processes can be started