Detailed explanation of installing Elasticsearch on Liunx - personal test practice

Note: The version of the Linux system used: CentOS Linux release 8.0.1905 (Core) View command:

[root@VM-16-15-centos ~]# cat /etc/redhat-release 
CentOS Linux release 8.0.1905 (Core) 

Installation preparation

1. Can be downloaded from the official website

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

2. You can also download it from the tool library I prepared.

Link: https://pan.baidu.com/s/1rWYvUQEUqVlxR4g_jryfvg Extraction code: f8ji

start installation 

1. Upload the downloaded file to the server and upload it to the specified folder

[root@VM-16-15-centos software]# ls
elasticsearch-6.6.2.tar.gz  mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz  rocketmq-all-4.7.1-bin-release.zip
jdk-8u221-linux-x64.tar.gz  redis-6.2.5.tar.gz                          rocketmq-console-ng-1.0.1.tar.gz
[root@VM-16-15-centos software]# pwd
/opt/software
[root@VM-16-15-centos software]# 

 2. Unzip the file and move it to the app folder you created /opt/app/ 

# tar -zxvf elasticsearch-6.6.2.tar.gz
# mv elasticsearch-6.6.2 /opt/app/

进入到 elasticsearch-6.6.2 文件夹下创建data和logs文件夹、并赋予权限
# mkdir data;
# mkdir logs; 
# chmod 777 data或logs;

修改config文件下的elasticsearch.yml 文件中的data和logs文件配置路径
# path.data: /opt/local2019/elastics/elasticsearch-6.6.2/data
# path.logs: /opt/local2019/elastics/elasticsearch-6.6.2/logs

The directory structure is as follows:

 start up

【关键】ElasticSearch不能以root用户启动

创建一个新用户
[root@VM-16-15-centos bin]# adduser elasticsearch

创建用户密码,需要输入两次
[root@VM-16-15-centos bin]# passwd elasticsearch

将对应的文件夹权限赋给该用户
[root@VM-16-15-centos local]# chown -R elasticsearch elasticsearch-6.6.2

切换至elasticsearch用户
[root@VM-16-15-centos etc]# su elasticsearch

进入启动目录启动 elasticsearch-6.0.0/bin  使用后台启动方式:./elasticsearch -d 或者 ./elasticsearch &
[root@VM-16-15-centos bin]$ ./elasticsearch -d  (或者./elasticsearch &)

Memory configuration

1、启动报错:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
  解决:编辑vim的大小设置:[root@VM-16-15-centos elk]# vim /etc/sysctl.conf
                        在/etc/sysctl.conf文件最后添加一行: vm.max_map_count=262144
重新启动:[root@VM-16-15-centos ~]# /sbin/sysctl -p
然后再启动es

2、elasticsearch 的jvm.options 的默认最小配置1G,不要改动

 Start access

1、http://127.0.0.1:9200/

2. You can also integrate the browser plug-in Elasticsearch-head

Guess you like

Origin blog.csdn.net/amosjob/article/details/120570099