如果有openjdk可以不安装
ES-7.15.2链接: https://pan.baidu.com/s/1O6eO8bauGr9JyGI9rUSDFw 提取码: empa
IK分词器链接: https://pan.baidu.com/s/1jeAoyp2WhFYvipQ_JhtD1Q 提取码: hib2
如果失效,私信获取
[root@localhost local]# pwd
/usr/local
[root@localhost local]# tar -xf /root/jdk-8u333-linux-x64.tar.gz
[root@localhost local]# mv jdk1.8.0_333 ./java
[root@localhost local]# cd java/
[root@localhost java]# ll
total 25816
drwxr-xr-x. 2 10143 10143 4096 Apr 26 2022 bin
-r--r--r--. 1 10143 10143 3244 Apr 26 2022 COPYRIGHT
drwxr-xr-x. 3 10143 10143 132 Apr 26 2022 include
-rw-r--r--. 1 10143 10143 5236958 Mar 10 2022 javafx-src.zip
-rw-r--r--. 1 10143 10143 195 Apr 26 2022 jmc.txt
drwxr-xr-x. 6 10143 10143 198 Apr 26 2022 jre
drwxr-xr-x. 4 10143 10143 31 Apr 26 2022 legal
drwxr-xr-x. 4 10143 10143 223 Apr 26 2022 lib
-r--r--r--. 1 10143 10143 44 Apr 26 2022 LICENSE
drwxr-xr-x. 4 10143 10143 47 Apr 26 2022 man
-r--r--r--. 1 10143 10143 159 Apr 26 2022 README.html
-rw-r--r--. 1 10143 10143 123 Apr 26 2022 release
-rw-r--r--. 1 10143 10143 21160666 Apr 26 2022 src.zip
-rw-r--r--. 1 10143 10143 190 Mar 10 2022 THIRDPARTYLICENSEREADME-JAVAFX.txt
-r--r--r--. 1 10143 10143 190 Apr 26 2022 THIRDPARTYLICENSEREADME.txt
配置环境变量在/etc/profile中添加
export JAVA_HOME=/usr/local/java export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib export PATH=$JAVA_HOME/bin:$PATH
在/etc/sysctl.conf添加如下配置
[root@localhost ~]# vim /etc/sysctl.conf
fs.file-max=655360 vm.max_map_count = 262144
再/etc/security/添加如下配置,包括前面的*
[root@localhost ~]# vim /etc/security/limits.conf
* soft nproc 20480 * hard nproc 20480 * soft nofile 65536 * hard nofile 65536 * soft memlock unlimited * hard memlock unlimited
执行如下命令使 /etc/sysctl.conf生效
[root@localhost ~]# sysctl -p
退出或重启当前终端
根据当前机器修改es的jvm内存大小
-Xms1g -Xmx1g
修改elasticsearch,修改的位置如下
cluster.name: myes node.name: node-1 path.data: /usr/local/elasticsearch/data path.logs: /usr/local/elasticsearch/data network.host: 0.0.0.0 cluster.initial_master_nodes: ["node-1"]
[root@localhost ~]# cd /usr/local/elasticsearch-7.15.2/
[root@localhost elasticsearch-7.15.2]# pwd
/usr/local/elasticsearch-7.15.2
[root@localhost elasticsearch-7.15.2]# vim config/jvm.options
[root@localhost elasticsearch-7.15.2]#
[root@localhost elasticsearch-7.15.2]# mkdir data
[root@localhost elasticsearch-7.15.2]# mkdir log
[root@localhost elasticsearch-7.15.2]# vim config/elasticsearch.yml
[root@localhost ~]# mv elasticsearch-analysis-ik-7.15.2.zip /usr/local/elasticsearch/plugins/ik/
[root@localhost ~]# cd /usr/local/elasticsearch/plugins/ik/
[root@localhost ik]# ll
total 4404
-rwx------. 1 root root 4507165 Jun 6 15:23 elasticsearch-analysis-ik-7.15.2.zip
[root@localhost ik]# unzip elasticsearch-analysis-ik-7.15.2.zip
[es@localhost config]# useradd es
[es@localhost config]# chown -R es:es /usr/local/elastic/elasticsearch
[es@localhost config]# su es
[es@localhost config]# /usr/local/elasticsearch/bin/./elasticsearch -d
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/java/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/java/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.
1)绿色——最健康的状态,代表所有的主分片和副本分片都可用;
2)黄色——所有的主分片可用,但是部分副本分片不可用;
3)红色——部分主分片不可用。(此时执行查询部分数据仍然可以查到,遇到这种情况,需要及时解决)
[root@localhost local]# curl http://localhost:9200/_cluster/health?pretty
{
"cluster_name" : "myes",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
带 * 的为主节点master
[root@localhost local]# curl http://localhost:9200/_cat/nodes?pretty
172.16.22.223 22 88 2 0.10 0.27 0.28 cdfhilmrstw * node-1
查看索引
[root@localhost local]# curl http://localhost:9200/_cat/indices?v