安装JAVA

  1. 安装java,下载安装包 安装包地址

image.png

  1. 解压,添加环境变量 ``` //解压 tar zxvf jdk-8u121-linux-x64.tar.gz

修改 /etc/profile 文件 //文件最后面添加 set java environment JAVA_HOME=/home/software/java/jdk1.8.0_201 //解压包地址 JRE_HOME=/home/software/java/jdk1.8.0_201/jre //解压包地址 CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH

//执行命令,让环境变量生效 source /etc/profile

//查看版本 [root@izw ~]# java -version java version “1.8.0_201” Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

  1. <a name="WJyWZ"></a>
  2. ### 安装Elasticsearch
  3. 1. [elasticsearch](https://so.csdn.net/so/search?q=elasticsearch&spm=1001.2101.3001.7020) 下载解压 下载地址:[https://www.elastic.co/cn/downloads/elasticsearch](https://www.elastic.co/cn/downloads/elasticsearch)
  4. ![image.png](https://cdn.nlark.com/yuque/0/2022/png/1467207/1642820915347-cb4d8a68-822f-4290-8155-bed12b0ba73f.png#clientId=u18ed2b2b-08fb-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=832&id=MghIv&margin=%5Bobject%20Object%5D&name=image.png&originHeight=799&originWidth=1600&originalType=binary&ratio=1&rotation=0&showTitle=false&size=126509&status=done&style=none&taskId=ue48fb7ae-fd11-4202-aebc-5ddfdbfa1e7&title=&width=1666.6667039195704)
  5. 2. 解压

tar -zxvf elasticsearch-6.1.1.tar.gz


3. 修改配置文件 /config/elasticsearch.yml

//添加 下面几行 xpack.ml.enabled: false network.host: 0.0.0.0 http.port: 8833

memory

bootstrap.memory_lock: false bootstrap.system_call_filter: false

node

node.name: node-1 cluster.initial_master_nodes: [“node-1”]


4. 修改配置文件 /config/ jvm.options

//修改为,128m 不然本机1G的运行内存 用不了 -Xms128m -Xmx128m


5. 添加linux 子用户,启用elasticsearch

//根目录下创建用户,密码

[root@izwz9fgwaldgwiyc3d37ztz ~]# useradd temp [root@izwz9fgwaldgwiyc3d37ztz ~]# passwd temp

//给于temp 权限 不然启动会报错

chown -R temp:temp /home/software/elasticsearch/

//修改 /etc/sysctl.conf //末尾添加 不然该权限组用户 虚拟内存不足

vm.max_map_count=262144

//查看并更新 sysctl -p

[root@izwz9fgwaldgwiyc3d37ztz ~]# sysctl -p net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 kernel.sysrq = 1 vm.max_map_count=262144


6. 用temp 账号登陆,启动es

//进入目录 cd /home/software/elasticsearch/elasticsearch-7.0.0

//启动 elasticsearch ./bin/elasticsearch ```

  1. 访问 http://119.23.xxx.xxx:8833/ 启动成功即可

image.png