当前位置: 首页 > news >正文

太原网站排名优化价格/市场推广方案范文

太原网站排名优化价格,市场推广方案范文,有风格的网站,宜昌 网站建设Elasticsearch8.3.2搭建部署详细步骤 0.过往文章 ES-6文章: Elasticsearch6.6.0部署、原理和使用介绍: https://blog.csdn.net/wt334502157/article/details/119515730 ES-7文章: Elasticsearch7.6.1部署、原理和使用介绍: https://blog.csdn.net/wt…
Elasticsearch8.3.2搭建部署详细步骤

0.过往文章

ES-6文章:

Elasticsearch6.6.0部署、原理和使用介绍: https://blog.csdn.net/wt334502157/article/details/119515730

ES-7文章:

Elasticsearch7.6.1部署、原理和使用介绍: https://blog.csdn.net/wt334502157/article/details/127693231

ES8正文- Elasticsearch8.3.2搭建部署详细步骤

1.环境准备

1-1.机器规划

IP地址操作系统主机名角色
172.28.54.213CentOS7.8es01master&data节点
172.28.54.214CentOS7.8es02master&data节点
172.28.54.215CentOS7.8es03master&data节点
  1. es各节点均为master,Elasticsearch-8版本部署的集群无主思想

  2. 这里使用了三台全新的机器,考虑到es版本8对java的要求相对较高,如机器部署的应用较多,避免java环境混乱以及应用之间相互影响,所以es8不建议使用在已经部署较多java环境的应用机器。

ES各版本对java版本的需求:

  • ES 7.x 及之前版本:选择 Java 8

  • ES 8.x,支持 Java 17 和 Java 18,推荐版本:

    • 其中对于ES 8.0:Java版本仅支持 Java 17
    • ES 8.1及以上版本:支持Java 17 以及 Java 18,建议使用Java 17

【注意】

  1. Java 9、Java 10、Java 12 和 Java 13 均为官方公布的短期版本,ES各版本均不推荐使用这几个
  2. ES 8.1及以上版本的es对应版本的 Logstash 不支持 Java 18
  3. elasticsearch项目的jdk目录下现在已经内置了openjdk18,也可以直接使用

1-2.各节点设置主机名

# 172.28.54.213
hostnamectl set-hostname es01# 172.28.54.214
hostnamectl set-hostname es01# 172.28.54.215
hostnamectl set-hostname es01

1-3.各节点创建普通用户

ES不能使用root用户来启动,否则会报错,使用普通用户来安装启动。创建一个普通用户以及定义一些常规目录用于存放我们的数据文件以及安装包等

# 3台机器都需要执行
[root@es01 ~]# useradd wangting && echo wangting|passwd --stdin wangting

1-4.各节点将普通用户权限提高

[root@es01 ~]# visudo
# 增加一行普通用户权限内容
wangting ALL=(ALL) NOPASSWD:ALL

让普通用户有更大的操作权限,一般都会给普通用户设置sudo权限,方便普通用户的操作,避免操作时频繁输入密码

1-5.各节点添加hosts主机名解析

[root@es01 ~]# vim /etc/hosts
# es
172.28.54.213 es01
172.28.54.214 es02
172.28.54.215 es03

如果在各节点的/etc/hosts中都配置了节点的ip解析,那后续在配置文件中,相关的ip配置都可以用解析名代替

1-6.安装包准备

各组件均可以在官方找到对应版本下载:

官方下载安装包地址:https://www.elastic.co/cn/downloads/elasticsearch

# 下载安装包
[root@es01 ~]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.2-linux-x86_64.tar.gz
[root@es01 ~]# ls -l
total 526672
-rw-r--r-- 1 root root 539306119 Jul  7  2022 elasticsearch-8.3.2-linux-x86_64.tar.gz

1-7.各节点环境优化(各节点)

  • 注意环境优化为各节点均要执行的实施操作,需要自行在每个节点去执行命令

1-7-1.优化1:最大文件数

系统允许 Elasticsearch 打开的最大文件数需要修改成65536

[root@es01 ~]# vim /etc/security/limits.conf
# End of file
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 65536# 断开重连会话
[root@es01 ~]# ulimit -n
65536

如果这个配置不优化后续启动服务会出现:
[error] max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536] elasticsearch

1-7-2.优化2:最大进程数

允许最大进程数配置修该成4096;不是4096则需要修改优化

[root@es01 ~]# vim /etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.*          soft    nproc     4096
root       soft    nproc     unlimited

这个配置不优化启动服务会出现:
[error]max number of threads [1024] for user [judy2] likely too low, increase to at least [4096]

1-7-3.优化3:虚拟内存

设置一个进程可以拥有的虚拟内存区域的数量

# 增加配置项vm.max_map_count
[root@es01 ~]# vim /etc/sysctl.conf 
vm.max_map_count=262144
# 重载配置
[root@es01 ~]# sysctl -p

这个配置不优化启动服务会出现:
[error]max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

2.安装es

2-1.解压安装

[root@es01 ~]# mkdir -p /opt/module/
[root@es01 ~]# chown -R wangting.wangting /opt/module/
[root@es01 ~]# tar -xf elasticsearch-8.3.2-linux-x86_64.tar.gz -C /opt/module/
[root@es01 ~]# chown -R wangting.wangting /opt/module/elasticsearch-8.3.2
[root@es01 ~]# cd /opt/module/elasticsearch-8.3.2/
[root@es01 elasticsearch-8.3.2]# ls -l
total 892
drwxr-xr-x  2 wangting wangting   4096 Jul  6  2022 bin
drwxr-xr-x  3 wangting wangting   4096 Feb 10 15:05 config
drwxr-xr-x  8 wangting wangting   4096 Jul  6  2022 jdk
drwxr-xr-x  5 wangting wangting   4096 Jul  6  2022 lib
-rw-r--r--  1 wangting wangting   3860 Jul  6  2022 LICENSE.txt
drwxr-xr-x  2 wangting wangting   4096 Jul  6  2022 logs
drwxr-xr-x 66 wangting wangting   4096 Jul  6  2022 modules
-rw-r--r--  1 wangting wangting 874704 Jul  6  2022 NOTICE.txt
drwxr-xr-x  2 wangting wangting   4096 Jul  6  2022 plugins
-rw-r--r--  1 wangting wangting   2710 Jul  6  2022 README.asciidoc

2-2.修改profile环境

[root@es01 elasticsearch-8.3.2]# vim /etc/profile
# ES
export JAVA_HOME=/opt/module/elasticsearch-8.3.2/jdk
export ES_HOME=/opt/module/elasticsearch-8.3.2
export PATH=$PATH:$ES_HOME/bin# 引用
[root@es01 elasticsearch-8.3.2]# source /etc/profile
[root@es01 ~]# /opt/module/elasticsearch-8.3.2/jdk/bin/java -version
openjdk version "18.0.1.1" 2022-04-22
OpenJDK Runtime Environment (build 18.0.1.1+2-6)
OpenJDK 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)# ###节点es02上操作###
[root@es02 ~]# vim /etc/profile
# ES
export JAVA_HOME=/opt/module/elasticsearch-8.3.2/jdk
export ES_HOME=/opt/module/elasticsearch-8.3.2
export PATH=$PATH:$ES_HOME/bin[root@es02 ~]# source /etc/profile# ###节点es03上操作###
[root@es03 ~]# vim /etc/profile
# ES
export JAVA_HOME=/opt/module/elasticsearch-8.3.2/jdk
export ES_HOME=/opt/module/elasticsearch-8.3.2
export PATH=$PATH:$ES_HOME/bin[root@es03 ~]# source /etc/profile

2-3.创建es相关目录

# 创建数据文件目录
[root@es01 ~]# mkdir -p /opt/module/elasticsearch-8.3.2/data
# 创建证书生成目录
[root@es01 ~]# mkdir -p /opt/module/elasticsearch-8.3.2/config/certs
# 目录有改动,重新刷一下权限
[root@es01 module]# chown -R wangting:wangting /opt/module/elasticsearch-8.3.2# 分发至es02、es03
# 新建目录
[root@es02 ~]# mkdir -p /opt/module
[root@es03 ~]# mkdir -p /opt/module
# 分发到其他节点,并在02 03上查看操作文件权限
[root@es01 ~]# scp -r /opt/module/elasticsearch-8.3.2 es02:/opt/module/elasticsearch-8.3.2
[root@es01 ~]# scp -r /opt/module/elasticsearch-8.3.2 es03:/opt/module/elasticsearch-8.3.2
# 目录文件权限刷用户所属
[root@es02 module]# chown -R wangting:wangting /opt/module/elasticsearch-8.3.2
[root@es03 module]# chown -R wangting:wangting /opt/module/elasticsearch-8.3.2

2-4.证书签发

# 在第一台服务器节点es01 设置集群多节点通信密钥
# 切换普通用户实施
[root@es01 module]# su - wangting
[wangting@es01 ~]$ cd /opt/module/elasticsearch-8.3.2/bin
[wangting@es01 bin]$ ./elasticsearch-certutil ca
warning: ignoring JAVA_HOME=/opt/module/elasticsearch-8.3.2/jdk; using bundled JDK
This tool assists you in the generation of X.509 certificates and certificate
signing requests for use with SSL/TLS in the Elastic stack.
The 'ca' mode generates a new 'certificate authority'
This will create a new X.509 certificate and private key that can be used
to sign certificate when running in 'cert' mode.Use the 'ca-dn' option if you wish to configure the 'distinguished name'
of the certificate authorityBy default the 'ca' mode produces a single PKCS#12 output file which holds:* The CA certificate* The CAs private keyIf you elect to generate PEM format certificates (the -pem option), then the output will
be a zip file containing individual files for the CA certificate and private keyPlease enter the desired output file [elastic-stack-ca.p12]: # 回车即可
Enter password for elastic-stack-ca.p12 :  # 回车即可# 用 ca 证书签发节点证书,过程中需按三次回车键,生成目录:es的home:/opt/elasticsearch-8.3.2/
[wangting@es01 bin]$ ./elasticsearch-certutil cert --ca elastic-stack-ca.p12If you specify any of the following options:* -pem (PEM formatted output)* -multiple (generate multiple certificates)* -in (generate certificates from an input file)
then the output will be be a zip file containing individual certificate/key filesEnter password for CA (elastic-stack-ca.p12) :  # 回车即可
Please enter the desired output file [elastic-certificates.p12]:  # 回车即可
Enter password for elastic-certificates.p12 :  # 回车即可Certificates written to /opt/module/elasticsearch-8.3.2/elastic-certificates.p12This file should be properly secured as it contains the private key for 
your instance.
This file is a self contained file and can be copied and used 'as is'
For each Elastic product that you wish to configure, you should copy
this '.p12' file to the relevant configuration directory
and then follow the SSL configuration instructions in the product guide.For client applications, you may only need to copy the CA certificate and
configure the client to trust this certificate.# 将生成的证书文件移动到 config/certs 目录中
[wangting@es01 bin]$ cd /opt/module/elasticsearch-8.3.2/
[wangting@es01 elasticsearch-8.3.2]$ ls -l | grep "elastic-"
-rw-------  1 wangting wangting   3596 Feb 10 16:05 elastic-certificates.p12
-rw-------  1 wangting wangting   2672 Feb 10 16:03 elastic-stack-ca.p12
[wangting@es01 elasticsearch-8.3.2]$ 
[wangting@es01 elasticsearch-8.3.2]$ mv elastic-certificates.p12 config/certs/
[wangting@es01 elasticsearch-8.3.2]$ mv elastic-stack-ca.p12 config/certs/

2-5.设置集群多节点 HTTP 证书

# 签发 Https 证书
[wangting@es01 elasticsearch-8.3.2]$ cd /opt/module/elasticsearch-8.3.2/bin/
[wangting@es01 bin]$ ./elasticsearch-certutil http
warning: ignoring JAVA_HOME=/opt/module/elasticsearch-8.3.2/jdk; using bundled JDK## Elasticsearch HTTP Certificate Utility
The 'http' command guides you through the process of generating certificates
for use on the HTTP (Rest) interface for Elasticsearch.
This tool will ask you a number of questions in order to generate the right
set of files for your needs.
## Do you wish to generate a Certificate Signing Request (CSR)?
A CSR is used when you want your certificate to be created by an existing
Certificate Authority (CA) that you do not control (that is, you do not have
access to the keys for that CA). 
If you are in a corporate environment with a central security team, then you
may have an existing Corporate CA that can generate your certificate for you.
Infrastructure within your organisation may already be configured to trust this
CA, so it may be easier for clients to connect to Elasticsearch if you use a
CSR and send that request to the team that controls your CA.
If you choose not to generate a CSR, this tool will generate a new certificate
for you. That certificate will be signed by a CA under your control. This is a
quick and easy way to secure your cluster with TLS, but you will need to
configure all your clients to trust that custom CA.
######################################################
# 是否生成CSR,选择 N ,不需要                           #
######################################################
Generate a CSR? [y/N]N## Do you have an existing Certificate Authority (CA) key-pair that you wish to use to sign your certificate?If you have an existing CA certificate and key, then you can use that CA to
sign your new http certificate. This allows you to use the same CA across
multiple Elasticsearch clusters which can make it easier to configure clients,
and may be easier for you to manage.If you do not have an existing CA, one will be generated for you.
######################################################
# 是否使用已经存在的CA证书,选择 y ,因为已经创建签发好了CA    #
######################################################
Use an existing CA? [y/N]y## What is the path to your CA?
Please enter the full pathname to the Certificate Authority that you wish to
use for signing your new http certificate. This can be in PKCS#12 (.p12), JKS
(.jks) or PEM (.crt, .key, .pem) format.
######################################################
# 指定CA证书的路径地址,CA Path:后写绝对路径               #
######################################################
CA Path: /opt/module/elasticsearch-8.3.2/config/certs/elastic-stack-ca.p12
Reading a PKCS12 keystore requires a password.
It is possible for the keystore's password to be blank,
in which case you can simply press <ENTER> at the prompt######################################################
# 设置密钥库的密码,直接 回车 即可                         #
######################################################
Password for elastic-stack-ca.p12:## How long should your certificates be valid?Every certificate has an expiry date. When the expiry date is reached clients
will stop trusting your certificate and TLS connections will fail.
Best practice suggests that you should either:
(a) set this to a short duration (90 - 120 days) and have automatic processes
to generate a new certificate before the old one expires, or
(b) set it to a longer duration (3 - 5 years) and then perform a manual update
a few months before it expires.You may enter the validity period in years (e.g. 3Y), months (e.g. 18M), or days (e.g. 90D)
######################################################
# 设置证书的失效时间,这里的y表示年,5y则代表失效时间5年       #
######################################################
For how long should your certificate be valid? [5y] 5y## Do you wish to generate one certificate per node?If you have multiple nodes in your cluster, then you may choose to generate a
separate certificate for each of these nodes. Each certificate will have its
own private key, and will be issued for a specific hostname or IP address.Alternatively, you may wish to generate a single certificate that is valid
across all the hostnames or addresses in your cluster.If all of your nodes will be accessed through a single domain
(e.g. node01.es.example.com, node02.es.example.com, etc) then you may find it
simpler to generate one certificate with a wildcard hostname (*.es.example.com)
and use that across all of your nodes.However, if you do not have a common domain name, and you expect to add
additional nodes to your cluster in the future, then you should generate a
certificate per node so that you can more easily generate new certificates when
you provision new nodes.######################################################
# 是否需要为每个节点都生成证书,选择 N 无需每个节点都配置证书   #
######################################################
Generate a certificate per node? [y/N]N## Which hostnames will be used to connect to your nodes?
These hostnames will be added as "DNS" names in the "Subject Alternative Name"
(SAN) field in your certificate.
You should list every hostname and variant that people will use to connect to
your cluster over http.
Do not list IP addresses here, you will be asked to enter them later.If you wish to use a wildcard certificate (for example *.es.example.com) you
can enter that here.Enter all the hostnames that you need, one per line.
######################################################
# 输入需连接集群节点主机名信息,一行输入一个IP地址,空行回车结束 #
######################################################
When you are done, press <ENTER> once more to move on to the next step.es01
es02
es03You entered the following hostnames.- es01- es02- es03####################################################
# 确认以上是否为正确的配置,输入 Y 表示信息正确            #
####################################################
Is this correct [Y/n]Y## Which IP addresses will be used to connect to your nodes?
If your clients will ever connect to your nodes by numeric IP address, then you
can list these as valid IP "Subject Alternative Name" (SAN) fields in your
certificate.If you do not have fixed IP addresses, or not wish to support direct IP access
to your cluster then you can just press <ENTER> to skip this step.Enter all the IP addresses that you need, one per line.
####################################################
# 输入需连接集群节点IP信息,一行输入一个IP地址,空行回车结束 #
####################################################
When you are done, press <ENTER> once more to move on to the next step.172.28.54.213
172.28.54.214
172.28.54.215You entered the following IP addresses.- 172.28.54.213- 172.28.54.214- 172.28.54.215####################################################
# 确认以上是否为正确的配置,输入 Y 表示信息正确            #
####################################################
Is this correct [Y/n]Y## Other certificate options
The generated certificate will have the following additional configuration
values. These values have been selected based on a combination of the
information you have provided above and secure defaults. You should not need to
change these values unless you have specific requirements.Key Name: es01
Subject DN: CN=es01
Key Size: 2048####################################################
# 是否要更改以上这些选项,选择 N ,不更改证书选项配置       #
####################################################
Do you wish to change any of these options? [y/N]N## What password do you want for your private key(s)?Your private key(s) will be stored in a PKCS#12 keystore file named "http.p12".
This type of keystore is always password protected, but it is possible to use a
blank password.####################################################
# 是否要给证书加密,不需要加密,两次 回车 即可             #
####################################################
If you wish to use a blank password, simply press <enter> at the prompt below.
Provide a password for the "http.p12" file:  [<ENTER> for none]## Where should we save the generated files?
A number of files will be generated including your private key(s),
public certificate(s), and sample configuration options for Elastic Stack products.
These files will be included in a single zip archive.
What filename should be used for the output zip file? [/opt/module/elasticsearch-8.3.2/elasticsearch-ssl-http.zip] 
Zip file written to /opt/module/elasticsearch-8.3.2/elasticsearch-ssl-http.zip

2-6.解压证书并分发

# 解压
[wangting@es01 bin]$ cd /opt/module/elasticsearch-8.3.2/
[wangting@es01 elasticsearch-8.3.2]$ unzip elasticsearch-ssl-http.zip 
# 移动证书
[wangting@es01 elasticsearch-8.3.2]$ mv ./elasticsearch/http.p12 config/certs/
[wangting@es01 elasticsearch-8.3.2]$ mv ./kibana/elasticsearch-ca.pem config/certs/# 将证书分发到其他节点02 03
[wangting@es01 elasticsearch-8.3.2]$ cd /opt/module/elasticsearch-8.3.2/config/certs
[wangting@es01 certs]$ ll
total 16
-rw------- 1 wangting wangting 3596 Feb 10 16:05 elastic-certificates.p12
-rw-rw-r-- 1 wangting wangting 1200 Feb 10 16:13 elasticsearch-ca.pem
-rw------- 1 wangting wangting 2672 Feb 10 16:03 elastic-stack-ca.p12
-rw-rw-r-- 1 wangting wangting 3652 Feb 10 16:13 http.p12
[wangting@es01 certs]$ scp * es02:/opt/module/elasticsearch-8.3.2/config/certs/
[wangting@es01 certs]$ scp * es03:/opt/module/elasticsearch-8.3.2/config/certs/

如果提示:-bash: unzip: command not found,使用yum安装即可

[wangting@es01 elasticsearch-8.3.2]$ sudo yum install -y unzip

2-7.配置文件修改配置

[wangting@es01 certs]$ cd /opt/module/elasticsearch-8.3.2/config/
[wangting@es01 config]$ vim elasticsearch.yml 
cluster.name: bigdata-es
node.name: es-es01
path.data: /opt/module/elasticsearch-8.3.2/data
path.logs: /opt/module/elasticsearch-8.3.2/logs
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["es01"]
cluster.initial_master_nodes: ["es-es01", "es-es02","es-es03"]
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:enabled: truekeystore.path: /opt/module/elasticsearch-8.3.2/config/certs/http.p12truststore.path: /opt/module/elasticsearch-8.3.2/config/certs/http.p12
xpack.security.transport.ssl:enabled: trueverification_mode: certificatekeystore.path: /opt/module/elasticsearch-8.3.2/config/certs/elastic-certificates.p12truststore.path: /opt/module/elasticsearch-8.3.2/config/certs/elastic-certificates.p12
http.host: [_local_, _site_]
ingest.geoip.downloader.enabled: false
xpack.security.http.ssl.client_authentication: none

【注意】:

  1. xpack.security.http.ssl & xpack.security.transport.ssl后的子配置需要空一格,遵循yml的格式要求

  2. 如果不需要后续的http证书认证或者用户密码认证可以将xpack.security相关的功能falase关闭掉

    xpack.security.http.ssl:enabled: false
    xpack.security.transport.ssl:enabled: false
    

有些业务使用场景中,可能会遇到跨域问题,当elasticsearch需要涉及到跨域问题时,可以在配置文件中最后增加配置:

http.cors.enabled: true
http.cors.allow-origin: "*"

2-8.修改其余节点的配置文件

[wangting@es01 elasticsearch-8.3.2]$ scp config/elasticsearch.yml es02:/opt/module/elasticsearch-8.3.2/config/
[wangting@es01 elasticsearch-8.3.2]$ scp config/elasticsearch.yml es03:/opt/module/elasticsearch-8.3.2/config/# es02修改 config/elasticsearch.yml
[wangting@es02 ~]# vim /opt/module/elasticsearch-8.3.2/config/elasticsearch.yml 
# 设置节点名称
node.name: es-es02# es03修改 config/elasticsearch.yml
[wangting@es03 ~]# vim /opt/module/elasticsearch-8.3.2/config/elasticsearch.yml 
# 设置节点名称
node.name: es-es03

2-9.启动集群

每台节点依次启动(无顺序要求,只要多于2台,就可以启动集群,这就是es的无主模式,自动识别集群,选举master):

[wangting@es01 elasticsearch-8.3.2]$ /opt/module/elasticsearch-8.3.2/bin/elasticsearch  -d
[wangting@es02 elasticsearch-8.3.2]$ /opt/module/elasticsearch-8.3.2/bin/elasticsearch  -d
[wangting@es03 elasticsearch-8.3.2]$ /opt/module/elasticsearch-8.3.2/bin/elasticsearch  -d

登录网页,都与之前的密码一致:elastic/bigdata

https://es01:9200/_cat/nodes?v

【注意】

如果不留神使用root修改过目录下文件,则文件权限会变成root所属主,所以需要修改回普通用户

​ sudo chown -R wangting.wangting /opt/module/

ES服务启动后有2个端口

  • 9200为客户端访问es的http协议RESTFUL端口
  • 9300为ES集群之间组件的通信端口

2-10.修改HTTP登录密码

# 手工指定elastic的新密码 (-i参数)
[wangting@es01 ~]$ /opt/module/elasticsearch-8.3.2/bin/elasticsearch-reset-password -u elastic -i
warning: ignoring JAVA_HOME=/opt/module/elasticsearch-8.3.2/jdk; using bundled JDK
bThis tool will reset the password of the [elastic] user.
You will be prompted to enter the password.
Please confirm that you would like to continue [y/N]y 
Did not understand answer 'by'
Please confirm that you would like to continue [y/N]yEnter password for [elastic]: # 输入用户elastic的密码
Re-enter password for [elastic]: # 输入用户elastic的密码
Password for the [elastic] user successfully reset.
# 也可以不加-i参数让系统随机给个字符串密码,但是很难记住,很少使用
# 为elastic账号自动生成新的随机密码,输出至控制台;不加参数
[wangting@es01 ~]$ /opt/module/elasticsearch-8.3.2/bin/elasticsearch-reset-password -u elastic

2-11.页面访问验证

https://ip:9200 (注意是https)

账号密码为上面创建的:elastic / elastic的密码

2-12.集群启动|停止

  • 启动服务方式
[wangting@es01 ~]$ /opt/module/elasticsearch-8.3.2/bin/elasticsearch -d

【注意】:

  1. -d 为后台运行,不加-d只能前台运行,关了会话窗口服务也会同时终止
  2. 3台机器都需要启动elasticsearch
  3. 运行日志没有配置定义,默认在服务目录下:elasticsearch-8.3.2/logs/ ,有异常可以先查看日志
  • 停止服务方式
[wangting@es01 ~]$ ps -ef | grep elasticsearch|grep -vE "grep|controller" |awk -F" " '{print $2}' | xargs kill -9
  • 脚本
# 需先配置免密登录
[wangting@es01 ~]$ ssh-keygen -t rsa
[wangting@es01 ~]$ ssh-copy-id es01
[wangting@es01 ~]$ ssh-copy-id es02
[wangting@es01 ~]$ ssh-copy-id es03# 编写脚本
[wangting@es01 ~]$ vim my_es.sh
#! /bin/bash
if (($#==0)); thenecho -e "请输入参数:\n start  启动elasticsearch集群;\n stop  停止elasticsearch集群;\n" && exit
ficase $1 in"start")for host in es01 es02 es03doecho "---------- $1 $host 的elasticsearch ----------"ssh $host "/opt/module/elasticsearch-8.3.2/bin/elasticsearch -d >/dev/null 2>&1"done;;"stop")for host in es01 es02 es03doecho "---------- $1 $host 的elasticsearch ----------"ssh $host "ps -ef | grep elasticsearch|grep -v grep|grep -v controller |awk '{print $2}' | xargs kill -9" > /dev/null 2>&1done;;*)echo -e "---------- 请输入正确的参数 ----------\n"echo -e "start  启动elasticsearch集群;\n stop  停止elasticsearch集群;\n" && exit;;
esac

启动集群:

等待脚本执行结束

[wangting@es01 ~]$ bash my_es.sh start

停止集群:

[wangting@es01 ~]$ bash my_es.sh stop

相关文章:

elasticsearch8.3.2搭建部署

Elasticsearch8.3.2搭建部署详细步骤 0.过往文章 ES-6文章&#xff1a; Elasticsearch6.6.0部署、原理和使用介绍: https://blog.csdn.net/wt334502157/article/details/119515730 ES-7文章&#xff1a; Elasticsearch7.6.1部署、原理和使用介绍: https://blog.csdn.net/wt…...

MySQL_InnoDB引擎

InnoDB引擎 逻辑存储结构 表空间&#xff08;ibd文件&#xff09;&#xff0c;一个mysql实例可以对应多个表空间&#xff0c;用于存储记录、索引等数据。 段&#xff0c;分为数据段&#xff08;Leaf node segment&#xff09;、索引段(Non-leaf node segment)、回滚段(Rollba…...

json-server使用

文章目录json-server使用简介安装json-server启动json-server操作创建数据库查询数据增加数据删除数据修改数据putpatch配置静态资源静态资源首页资源json-server使用 简介 github地址 安装json-server npm install -g json-server启动json-server json-server --watch db…...

实现mint操作(参考pancake)

区块链发展越来越好&#xff0c;nft已经火了很久&#xff0c;今天写一下如何用js、web3js、调用合约&#xff0c;实现mint nft。简单的调用&#xff1a;//引入一些依赖 &#xff08;根据需要&#xff0c;有一些是其他功能的&#xff09; import useActiveWeb3React from ./web3…...

Linux进程信号

目录 一、认识信号 1.1 生活角度的信号 1.2 技术角度的信号 1.3 信号的发送与记录 1.4 常见信号处理方式 二、产生信号 2.1 通过终端按键产生信号(核心转储) 2.2 通过系统函数向进程发送信号 2.2.1 kill()函数 2.2.2 raise()函数 2.2.3 abort()函数 2.3 因软件条件…...

1.7 Web学生管理系统

1.定义通讯协议基于前面介绍过的 FLask Web 网站 与 urlib 的访问网站的方法&#xff0c;设计一个综合应用实例。它是一个基于 Web 的学生记录管理程序。学生的记录包括 id(学号) 、name(姓名) 、grade(成绩)&#xff0c;服务器的作用是建立与维护一个Sqllite 的学生数据库 stu…...

前端教学视频分享(视频内容与市场时刻保持紧密相连,火热更新中。。。)

⚠️获取公众号 本次要想大家推荐一下本人的公众号&#xff0c;在微信中搜索公众号 李帅豪在对话框中输入前端视频四个字即可立即获取所有视频&#xff0c;不收费无广告&#xff01;&#xff01;&#xff01; 本公众号收集了近两年来前端最新最优秀的学习视频&#xff0c;涵盖…...

Docker-consul的容器服务更新与发现

一.Consul概述1.1 什么是服务注册与发现服务注册与发现是微服务架构中不可或缺的重要组件。起初服务都是单节点的&#xff0c;不保障高可用性&#xff0c;也不考虑服务的压力承载&#xff0c;服务之间调用单纯的通过接口访问。直到后来出现了多个节点的分布式架构&#xff0c;起…...

Java笔记-线程中断

线程的中断 1.应用场景&#xff1a; 假设从网络下载一个100M的文件&#xff0c;如果网速很慢&#xff0c;用户等得不耐烦&#xff0c;就可能在下载过程中点“取消”&#xff0c;这时&#xff0c;程序就需要中断下载线程的执行。 2.常用中断线程的方法&#xff1a; 1.使用标…...

js中的自调用表达式

自调用表达式 由函数表达式创建的函数可以自调用&#xff0c;称之为自调用表达式。 语法 由函数表达式创建函数: const myFn function () {let a 100console.log(a);return a } myFn() //调用后执行&#xff0c;输出100表达式后面紧跟 ( ) 则会自动调用: const myFn fu…...

Python操作的5个坏习惯,你中了几个呢?

很多文章都有介绍怎么写好 Python&#xff0c;我今天呢相反&#xff0c;说说写代码时的几个坏习惯。有的习惯会让 Bug 变得隐蔽难以追踪&#xff0c;当然&#xff0c;也有的并没有错误&#xff0c;只是个人觉得不够完美。 注意&#xff1a;示例代码在 Python 3.6 环境下编写 …...

C++并发与多线程编程(3)---线程间共享数据

主要内容&#xff1a;共享数据带来的问题使用互斥量保护数据数据保护的替代方案共享数据带来的问题当涉及到共享数据时&#xff0c;问题可能是因为共享数据修改所导致。如果共享数据是只读的&#xff0c;那么只读操作不会影响到数据&#xff0c;更不会涉及对数据的修改&#xf…...

洞察:2022年医疗行业数据安全回顾及2023年展望

过去的2022年&#xff0c;统筹安全与发展&#xff0c;在医疗信息化发展道路中&#xff0c;数据安全不可或缺。这一年&#xff0c;实施五年多的《网络安全法》迎来首次修改&#xff0c;《数据安全法》、《个人信息保护法》实施一周年&#xff0c;配套的《数据出境安全评估办法》…...

多传感器融合定位十五-多传感器时空标定(综述)

多传感器融合定位十五-多传感器时空标定1. 多传感器标定简介1.1 标定内容及方法1.2 讲解思路2. 内参标定2.1 雷达内参标定2.2 IMU内参标定2.3 编码器内参标定2.4 相机内参标定3. 外参标定3.1 雷达和相机外参标定3.2 多雷达外参标定3.3 手眼标定3.4 融合中标定3.5 总结4. 时间标…...

开发微服务电商项目演示(三)

一&#xff0c;nginx动静分离第1步&#xff1a;通过SwitchHosts新增二级域名&#xff1a;images.zmall.com第2步&#xff1a;将本次项目的易买网所有静态资源js/css/images复制到nginx中的html目录下第3步&#xff1a;在nginx的核心配置文件nginx.conf中新增二级域名images.zma…...

C/C++排序算法(二) —— 选择排序和堆排序

文章目录前言1. 直接选择排序&#x1f351; 基本思想&#x1f351; 具体步骤&#x1f351; 具体步骤&#x1f351; 动图演示&#x1f351; 代码实现&#x1f351; 代码升级&#x1f351; 特性总结2. 堆排序&#x1f351; 向下调整算法&#x1f351; 任意树调整为堆的思想&#…...

爬虫笔记之——selenium安装与使用(1)

爬虫笔记之——selenium安装与使用&#xff08;1&#xff09;一、安装环境1、下载Chrome浏览器驱动&#xff08;1&#xff09;查看Chrome版本&#xff08;2&#xff09;下载相匹配的Chrome驱动程序地址&#xff1a;https://chromedriver.storage.googleapis.com/index.html2、学…...

STC15单片机软串口的使用

STC15软串口的使用&#x1f4d6;在没有使用定时器资源的情况下&#xff0c;根据波特率位传输时间&#xff0c;利用STC-ISP工具自动计算出位延时函数。 ✨在官方所提供的库函数中位传输时间函数,仅适用于使用波特率为&#xff1a;9600的串口数据传输&#xff1a; void BitTime(…...

Ansible的脚本------playbook剧本

一、剧本的前置知识点1、主机清单ansible默认的主机清单是/etc/ansible/hosts文件主机清单可以手动设置&#xff0c;也可以通过Dynamic Inventory动态生成一般主机名使用FQDNvi /etc/ansible/hosts [webserver] #使用方括号设置组名 www1.example.org #定…...

实验5-计算中值及分治技术

目录 1.寻找中位数(利用快速排序来寻找中位数) 2.分治方法求数组的和 3.合并排序...

dbeaver从excel导入数据笔记

场景 有excel的数据&#xff0c;需要做到数据库里。 方案一&#xff1a; 开发代码来实现。缺点是需要开发成本。 方案二&#xff1a; 数据库导入工具导入。不用开发&#xff0c;相对快速一些。 这里说下数据库工具导入。 操作过程 1、拿到excel数据文件&#xff0c;根据标题…...

PyTorch学习笔记:nn.MarginRankingLoss——排序损失

PyTorch学习笔记&#xff1a;nn.MarginRankingLoss——排序损失 torch.nn.MarginRankingLoss(margin0.0, size_averageNone, reduceNone, reductionmean)功能&#xff1a;创建一个排序损失函数&#xff0c;用于衡量输入x1x_1x1​与x2x_2x2​之间的排序损失(Ranking Loss)&…...

【JavaScript】34_Date对象 ,日期的格式化

8、Date Date 在JS中所有的和时间相关的数据都由Date对象来表示 对象的方法&#xff1a; getFullYear() 获取4位年份 getMonth() 返当前日期的月份&#xff08;0-11&#xff09; getDate() 返回当前是几日 getDay() 返回当前日期是周几&#xff08;0-6&#xff09; 0表示周日…...

计算机视觉 对比学习13篇经典论文、解读、代码

为了快速对 机器视觉中的对比学习有一个快速了解&#xff0c;或者后续复习&#xff0c;此处收录了 13篇经典论文、一些讲解地较好的博客和相应的Github代码&#xff0c;用不同颜色标记。 ​ 对比学习 13篇经典论文 论文代码和博客http://​www.webhub123.com/#/home/detail?p…...

MySQL 选择数据库

在你连接到 MySQL 数据库后&#xff0c;可能有多个可以操作的数据库&#xff0c;所以你需要选择你要操作的数据库。 在 MySQL 中就有很多系统自带的数据库&#xff0c;那么在操作数据库之前就必须要确定是哪一个数据库。 在 MySQL 中&#xff0c;USE 语句用来完成一个数据库到…...

雅思经验(9)

写作&#xff1a;关于趋势的上升和下降在小作文中&#xff0c;真的是非常常见的&#xff0c;所以还是要积累一下。下面给出了很多词&#xff0c;但是在雅思写作中并不是词越丰富&#xff0c;分数就越高的。雅思写作强调的是准确性&#xff1a;在合适的地方用合适的词和句法。不…...

java面试题(二十)中间件redis

1.1 Redis可以用来做什么&#xff1f; 参考答案 Redis最常用来做缓存&#xff0c;是实现分布式缓存的首先中间件&#xff1b;Redis可以作为数据库&#xff0c;实现诸如点赞、关注、排行等对性能要求极高的互联网需求&#xff1b;Redis可以作为计算工具&#xff0c;能用很小的…...

JavaWEB必知必会-Servlet

目录 Servlet简介Servlet快速入门Servlet配置详解ServletContext 1 Servlet简介 Servlet 运行在服务端的Java小程序&#xff0c;是sun公司提供一套规范&#xff08;接口&#xff09;&#xff0c;用来处理客户端请求、响应给浏览器的动态资源。但servlet的实质就是java代码&a…...

oralce查找返回不同的值,寻找不同的表(原创)

查找返回不同的值&#xff0c;寻找不同的表 select case a_id when 1 then (select b_id|| ||b_desc from b where b.b_ida.a_id) else (select e_id || ||e_desc from e where e.e_ida.a_id) end from a; 以上方法的缺陷是单表&#xff0c;判断。今天来了个挑战&#…...

Python-第四天 Python循环语句

Python-第四天 Python循环语句一、while循环1.while循环的基础语法2.while循环的基础案例3.while循环的嵌套应用4.while循环的嵌套案例二、for循环1.for循环的基础语法1.1基础语法1.2 range语句2.for循环的嵌套应用三、循环中断 : break和continue1.continue2.break四、 综合案…...