学习视频java
https://www.bilibili.com/video/BV1iJ411c7Az?from=search&seid=1238705428280301860node
1.建立目录linux
[root@VM_0_7_centos elsearch]# pwd /usr/local/elsearch
2. 下载安装包到目录vim
curl -# -O https://mirrors.huaweicloud.com/elasticsearch/7.9.2/elasticsearch-7.9.2-linux-x86_64.tar.gz
3.建立elsearch用户centos
elsearch 123456ssh
[root@VM_0_7_centos elsearch]# useradd elsearch
4. 将elsearch目录分配elsearch用户权限curl
[root@VM_0_7_centos elsearch]# chown elsearch:elsearch /usr/local/elsearch/ -R
[root@VM_0_7_centos local]# ll total 72 drwxr-xr-x. 2 root root 4096 Sep 24 23:18 bin drwxr-xr-x 2 elsearch elsearch 4096 Oct 26 21:00 elsearch
5. 切换用户jvm
[root@VM_0_7_centos elsearch]# su - elsearch Last failed login: Sun Oct 25 09:57:21 CST 2020 from 183.236.102.76 on ssh:notty There were 44 failed login attempts since the last successful login. [elsearch@VM_0_7_centos ~]$
6. 解压elasticsearch
[elsearch@VM_0_7_centos elsearch]$ tar -xvf elasticsearch-7.9.2-linux-x86_64.tar.gz
7. 修改配置文件ide
[elsearch@VM_0_7_centos elsearch]$ vim elasticsearch-7.9.2/config/elasticsearch.yml
cluster.name: cluster-es792 node.name: node-es792 network.host: 0.0.0.0 http.port: 9200 cluster.initial_master_nodes: ["node-es792"]
8. 修改 jvm.option
修改缘由:在ElasticSearch中若是network.host不是 localhost 或者127.0.0.1 就会认为是生产环境,会对环境的要求比较高,咱们的测试环境不必定可以知足,通常状况下 要修改2处配置以下:
8.1 修改jvm启动参数
[elsearch@VM_0_7_centos elsearch]$ vim elasticsearch-7.9.2/config/jvm.options
-Xms128m -Xmx128m
8.2 一个进程在VMAs(虚拟内存区域)建立内存映射最大数量
使用root 用户 修改
# vim /etc/sysctl.conf
在最后面加
vm.max_map_count=655360
使配置生效
# sysctl -p
9.启动
./elasticsearch 或者 # ./elasticsearch -d 后台启动
# ./elasticsearch -d
若是出现 java.nio.file.AccessDeniedException 错误
以root身份 从新执行 第4步
10. 验证
[elsearch@VM_0_7_centos bin]$ curl 127.0.0.1:9200 { "name" : "node-es792", "cluster_name" : "cluster-es792", "cluster_uuid" : "mkh08_bXTBSYkWJjIO2MvQ", "version" : { "number" : "7.9.2", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "d34da0ea4a966c4e49417f2da2f244e3e97b4e6e", "build_date" : "2020-09-23T00:45:33.626720Z", "build_snapshot" : false, "lucene_version" : "8.6.2", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }