Link Search Menu Expand Document Documentation Menu

Tarball

通过 Tarball(也称为 tar 归档文件)安装 OpenSearch,对于希望对文件权限和安装路径等安装细节进行精细控制的用户可能很有吸引力。

一般来说,通过 Tarball 安装 OpenSearch 可以分为几个步骤:

  1. 下载并解压 OpenSearch。
  2. 配置重要的系统设置。
    • 这些设置在修改任何 OpenSearch 文件之前应用于主机。
  3. (可选)测试 OpenSearch。
    • 在应用任何自定义配置之前,确认 OpenSearch 能够运行。
    • 这可以在没有任何安全设置(无密码、无证书)的情况下完成,或者使用一个可以通过打包脚本应用的演示安全配置来完成。
  4. 为您的环境配置 OpenSearch。
    • 将基本设置应用于 OpenSearch,并在您的环境中开始使用它。

Tarball 是一个自包含的目录,包含运行 OpenSearch 所需的一切,包括集成的 Java 开发工具包 (JDK)。此安装方法与大多数 Linux 发行版兼容,包括 CentOS 7、Amazon Linux 2 和 Ubuntu 18.04。如果您有自己的 Java 安装并在终端中设置了环境变量 JAVA_HOME,macOS 也同样适用。

本指南假定您熟悉使用 Linux 命令行界面 (CLI)。您应该了解如何输入命令、在目录之间导航以及编辑文本文件。某些示例命令引用了 vi 文本编辑器,但您可以使用任何可用的文本编辑器。

步骤 1:下载并解压 OpenSearch

  1. OpenSearch 下载页面下载相应的 tar.gz 归档文件,或通过命令行(例如使用 wget)下载。
    # x64
    wget https://artifacts.opensearch.org/releases/bundle/opensearch/3.1.0/opensearch-3.1.0-linux-x64.tar.gz
    
    # ARM64
    wget https://artifacts.opensearch.org/releases/bundle/opensearch/3.1.0/opensearch-3.1.0-linux-arm64.tar.gz
    
  2. 提取 Tarball 的内容。
    # x64
    tar -xvf opensearch-3.1.0-linux-x64.tar.gz
       
    # ARM64
    tar -xvf opensearch-3.1.0-linux-arm64.tar.gz
    

步骤 2:配置重要的系统设置

在启动 OpenSearch 之前,您应该查看一些重要的系统设置

  1. 禁用主机上的内存分页和交换以提高性能。
    sudo swapoff -a
    

  2. 增加 OpenSearch 可用的内存映射数量。
    # Edit the sysctl config file
    sudo vi /etc/sysctl.conf
    
    # Add a line to define the desired value
    # or change the value if the key exists,
    # and then save your changes.
    vm.max_map_count=262144
    
    # Reload the kernel parameters using sysctl
    sudo sysctl -p
    
    # Verify that the change was applied by checking the value
    cat /proc/sys/vm/max_map_count
    

步骤 3:(可选)测试 OpenSearch

在继续之前,您应该测试您的 OpenSearch 安装。否则,很难确定未来出现的问题是由于安装问题还是您在安装后应用的自定义设置造成的。在此阶段有两种快速测试 OpenSearch 的方法:

  1. (启用安全)使用 tar 归档文件中包含的演示安全脚本应用通用配置。
  2. (禁用安全)在应用您自己的自定义安全设置之前,手动禁用安全插件并测试实例。

演示安全脚本将通用配置应用于您的 OpenSearch 实例。此配置定义了一些环境变量,并应用了自签名 TLS 证书。如果您想自行配置这些,请参阅步骤 4:在您的环境中设置 OpenSearch

如果您只想验证服务是否正确配置,并且打算自行配置安全设置,那么您可能需要禁用安全插件,并在不加密或不进行身份验证的情况下启动服务。

由演示安全脚本配置的 OpenSearch 节点不适用于生产环境。如果您计划在运行 opensearch-tar-install.sh 后在生产环境中使用该节点,您至少应该用您自己的 TLS 证书替换演示 TLS 证书,并更新内部用户和密码列表。有关确保您的节点根据安全要求进行配置的更多指导,请参阅安全配置

选项 1:在启用安全的情况下测试您的 OpenSearch 设置

  1. 更改到您的 OpenSearch 安装的顶级目录。
    cd /path/to/opensearch-3.1.0
    

  2. 运行带有安全演示配置的 OpenSearch 启动脚本。
    ./opensearch-tar-install.sh
    

    对于 OpenSearch 2.12 或更高版本,请在安装前使用以下命令设置新的自定义管理员密码:

    $ export OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password>
    

  3. 打开另一个终端会话并向服务器发送请求,以验证 OpenSearch 是否正在运行。请注意使用 --insecure 标志,这是必需的,因为 TLS 证书是自签名的。
    • 向端口 9200 发送请求
       curl -X GET https://:9200 -u 'admin:<custom-admin-password>' --insecure
      

      您应该会收到如下响应:

       {
          "name" : "hostname",
          "cluster_name" : "opensearch",
          "cluster_uuid" : "6XNc9m2gTUSIoKDqJit0PA",
          "version" : {
             "distribution" : "opensearch",
             "number" : <version>,
             "build_type" : <build-type>,
             "build_hash" : <build-hash>,
             "build_date" : <build-date>,
             "build_snapshot" : false,
             "lucene_version" : <lucene-version>,
             "minimum_wire_compatibility_version" : "7.10.0",
             "minimum_index_compatibility_version" : "7.0.0"
          },
          "tagline" : "The OpenSearch Project: https://opensearch.org.cn/"
       }
      
    • 查询插件端点
       curl -X GET https://:9200/_cat/plugins?v -u 'admin:<custom-admin-password>' --insecure
      

      响应应如下所示:

       name     component                            version
       hostname opensearch-alerting                  3.1.0
       hostname opensearch-anomaly-detection         3.1.0
       hostname opensearch-asynchronous-search       3.1.0
       hostname opensearch-cross-cluster-replication 3.1.0
       hostname opensearch-index-management          3.1.0
       hostname opensearch-job-scheduler             3.1.0
       hostname opensearch-knn                       3.1.0
       hostname opensearch-ml                        3.1.0
       hostname opensearch-notifications             3.1.0
       hostname opensearch-notifications-core        3.1.0
       hostname opensearch-observability             3.1.0
       hostname opensearch-performance-analyzer      3.1.0
       hostname opensearch-reports-scheduler         3.1.0
       hostname opensearch-security                  3.1.0
       hostname opensearch-sql                       3.1.0
      
  4. 返回原始终端会话,按 CTRL + C 停止进程。

选项 2:在禁用安全的情况下测试您的 OpenSearch 设置

  1. 打开配置文件。
    vi /path/to/opensearch-3.1.0/config/opensearch.yml
    

  2. 添加以下行以禁用安全插件:
    plugins.security.disabled: true
    

  3. 保存更改并关闭文件。
  4. 打开另一个终端会话并向服务器发送请求,以验证 OpenSearch 是否正在运行。由于安全插件已被禁用,您将使用 HTTP 而不是 HTTPS 发送命令。
    • 向端口 9200 发送请求。
       curl -X GET https://:9200
      

      您应该会收到如下响应:

       {
          "name" : "hostname",
          "cluster_name" : "opensearch",
          "cluster_uuid" : "6XNc9m2gTUSIoKDqJit0PA",
          "version" : {
             "distribution" : "opensearch",
             "number" : <version>,
             "build_type" : <build-type>,
             "build_hash" : <build-hash>,
             "build_date" : <build-date>,
             "build_snapshot" : false,
             "lucene_version" : <lucene-version>,
             "minimum_wire_compatibility_version" : "7.10.0",
             "minimum_index_compatibility_version" : "7.0.0"
          },
          "tagline" : "The OpenSearch Project: https://opensearch.org.cn/"
       }
      
    • 查询插件端点。
       curl -X GET https://:9200/_cat/plugins?v
      

      响应应如下所示:

       name     component                            version
       hostname opensearch-alerting                  3.1.0
       hostname opensearch-anomaly-detection         3.1.0
       hostname opensearch-asynchronous-search       3.1.0
       hostname opensearch-cross-cluster-replication 3.1.0
       hostname opensearch-index-management          3.1.0
       hostname opensearch-job-scheduler             3.1.0
       hostname opensearch-knn                       3.1.0
       hostname opensearch-ml                        3.1.0
       hostname opensearch-notifications             3.1.0
       hostname opensearch-notifications-core        3.1.0
       hostname opensearch-observability             3.1.0
       hostname opensearch-performance-analyzer      3.1.0
       hostname opensearch-reports-scheduler         3.1.0
       hostname opensearch-security                  3.1.0
       hostname opensearch-sql                       3.1.0
      

步骤 4:在您的环境中设置 OpenSearch

没有 OpenSearch 经验的用户可能希望获得一份推荐设置列表,以便开始使用该服务。默认情况下,OpenSearch 未绑定到网络接口,无法被外部主机访问。此外,如果您通过调用 opensearch-tar-install.sh 运行了安全演示脚本,安全设置要么未定义(全新安装),要么由默认用户名和密码填充。以下建议将使您能够将 OpenSearch 绑定到网络接口、创建和签署 TLS 证书,以及配置基本身份验证。

以下推荐设置将允许您:

  • 将 OpenSearch 绑定到主机上的 IP 或网络接口。
  • 设置初始和最大 JVM 堆大小。
  • 定义一个指向捆绑 JDK 的环境变量。
  • 配置您自己的 TLS 证书——无需第三方证书颁发机构 (CA)。
  • 创建具有自定义密码的管理员用户。

如果您运行了安全演示脚本,则需要手动重新配置已修改的设置。在继续之前,请参阅安全配置以获取指导。

在修改任何配置文件之前,最好先保存一份备份副本。备份文件可用于回滚由错误配置引起的任何问题。

  1. 打开 opensearch.yml
    vi /path/to/opensearch-3.1.0/config/opensearch.yml
    

  2. 添加以下行。
    # Bind OpenSearch to the correct network interface. Use 0.0.0.0
    # to include all available interfaces or specify an IP address
    # assigned to a specific interface.
    network.host: 0.0.0.0
    
    # Unless you have already configured a cluster, you should set
    # discovery.type to single-node, or the bootstrap checks will
    # fail when you try to start the service.
    discovery.type: single-node
    
    # If you previously disabled the Security plugin in opensearch.yml,
    # be sure to re-enable it. Otherwise you can skip this setting.
    plugins.security.disabled: false
    

  3. 保存更改并关闭文件。
  4. 指定初始和最大 JVM 堆大小。
    1. 打开 jvm.options
        vi /path/to/opensearch-3.1.0/config/jvm.options
      

    2. 修改初始和最大堆大小的值。作为起点,您应该将这些值设置为可用系统内存的一半。对于专用主机,此值可以根据您的工作流要求增加。
      • 例如,如果主机有 8 GB 内存,那么您可能希望将初始和最大堆大小设置为 4 GB
        -Xms4g
        -Xmx4g
        

    3. 保存更改并关闭文件。
  5. 指定随附 JDK 的位置。
    export OPENSEARCH_JAVA_HOME=/path/to/opensearch-3.1.0/jdk
    

配置 TLS

TLS 证书通过允许客户端确认主机的身份以及加密客户端和主机之间的流量,为您的集群提供额外的安全保障。有关更多信息,请参阅配置 TLS 证书生成证书,这些都包含在安全插件文档中。对于在开发环境中进行的工作,自签名证书通常足够。本节将指导您完成生成自己的 TLS 证书并将其应用于 OpenSearch 主机所需的基本步骤。

  1. 导航到 OpenSearch config 目录。证书将存储在此处。
    cd /path/to/opensearch-3.1.0/config/
    

  2. 生成根证书。您将使用此证书来签署其他证书。
    # Create a private key for the root certificate
    openssl genrsa -out root-ca-key.pem 2048
       
    # Use the private key to create a self-signed root certificate. Be sure to
    # replace the arguments passed to -subj so they reflect your specific host.
    openssl req -new -x509 -sha256 -key root-ca-key.pem -subj "/C=CA/ST=ONTARIO/L=TORONTO/O=ORG/OU=UNIT/CN=ROOT" -out root-ca.pem -days 730
    
  3. 接下来,创建管理员证书。此证书用于获取提升的权限,以执行与安全插件相关的管理任务。
    # Create a private key for the admin certificate.
    openssl genrsa -out admin-key-temp.pem 2048
    
    # Convert the private key to PKCS#8.
    openssl pkcs8 -inform PEM -outform PEM -in admin-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out admin-key.pem
       
    # Create the CSR. A common name (CN) of "A" is acceptable because this certificate is
    # used for authenticating elevated access and is not tied to a host.
    openssl req -new -key admin-key.pem -subj "/C=CA/ST=ONTARIO/L=TORONTO/O=ORG/OU=UNIT/CN=A" -out admin.csr
       
    # Sign the admin certificate with the root certificate and private key you created earlier.
    openssl x509 -req -in admin.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out admin.pem -days 730
    
  4. 为正在配置的节点创建证书。
    # Create a private key for the node certificate.
    openssl genrsa -out node1-key-temp.pem 2048
       
    # Convert the private key to PKCS#8.
    openssl pkcs8 -inform PEM -outform PEM -in node1-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out node1-key.pem
       
    # Create the CSR and replace the arguments passed to -subj so they reflect your specific host.
    # The CN should match a DNS A record for the host--do not use the hostname.
    openssl req -new -key node1-key.pem -subj "/C=CA/ST=ONTARIO/L=TORONTO/O=ORG/OU=UNIT/CN=node1.dns.a-record" -out node1.csr
       
    # Create an extension file that defines a SAN DNS name for the host. This
    # should match the DNS A record of the host.
    echo 'subjectAltName=DNS:node1.dns.a-record' > node1.ext
       
    # Sign the node certificate with the root certificate and private key that you created earlier.
    openssl x509 -req -in node1.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out node1.pem -days 730 -extfile node1.ext
    
  5. 删除不再需要的临时文件。
    rm *temp.pem *csr *ext
    

  6. 按照生成证书中所述,将这些证书添加到opensearch.yml。高级用户也可以选择使用脚本追加设置。
    #! /bin/bash
    
    # Before running this script, make sure to replace the /path/to your OpenSearch directory,
    # and remember to replace the CN in the node's distinguished name with a real
    # DNS A record.
    
    echo "plugins.security.ssl.transport.pemcert_filepath: /path/to/opensearch-3.1.0/config/node1.pem" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.ssl.transport.pemkey_filepath: /path/to/opensearch-3.1.0/config/node1-key.pem" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.ssl.transport.pemtrustedcas_filepath: /path/to/opensearch-3.1.0/config/root-ca.pem" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.ssl.http.enabled: true" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.ssl.http.pemcert_filepath: /path/to/opensearch-3.1.0/config/node1.pem" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.ssl.http.pemkey_filepath: /path/to/opensearch-3.1.0/config/node1-key.pem" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.ssl.http.pemtrustedcas_filepath: /path/to/opensearch-3.1.0/config/root-ca.pem" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.allow_default_init_securityindex: true" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.authcz.admin_dn:" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "  - 'CN=A,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.nodes_dn:" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "  - 'CN=node1.dns.a-record,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.audit.type: internal_opensearch" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.enable_snapshot_restore_privilege: true" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.check_snapshot_restore_write_privileges: true" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    echo "plugins.security.restapi.roles_enabled: [\"all_access\", \"security_rest_api_access\"]" | sudo tee -a /path/to/opensearch-3.1.0/config/opensearch.yml
    

  7. (可选)为自签名根证书添加信任。
    # Copy the root certificate to the correct directory
    sudo cp /path/to/opensearch-3.1.0/config/root-ca.pem /etc/pki/ca-trust/source/anchors/
    
    # Add trust
    sudo update-ca-trust
    

配置用户

OpenSearch通过多种方式定义和认证用户。其中一种不需要额外后端基础设施的方法是手动在internal_users.yml中配置用户。有关配置用户的更多信息,请参阅YAML 文件。以下步骤说明如何删除除admin用户之外的所有演示用户,以及如何使用脚本替换admin的默认密码。

  1. 使安全插件脚本可执行。
    chmod 755 /path/to/opensearch-3.1.0/plugins/opensearch-security/tools/*.sh
    

  2. 运行hash.sh以生成新密码。
    • 如果未定义 JDK 路径,此脚本将失败。
       # Example output if a JDK isn't found...
       $ ./hash.sh
       **************************************************************************
       ** This tool will be deprecated in the next major release of OpenSearch **
       ** https://github.com/opensearch-project/security/issues/1755           **
       **************************************************************************
       which: no java in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin)
       WARNING: nor OPENSEARCH_JAVA_HOME nor JAVA_HOME is set, will use 
       ./hash.sh: line 35: java: command not found
      

    • 在调用脚本时声明环境变量,以避免问题。
       OPENSEARCH_JAVA_HOME=/path/to/opensearch-3.1.0/jdk ./hash.sh
      

    • 在提示符处输入所需密码,并记下输出的哈希值。
  3. 打开internal_users.yml
    vi /path/to/opensearch-3.1.0/config/opensearch-security/internal_users.yml
    

  4. 删除除admin之外的所有演示用户,并用前一步骤中hash.sh提供的哈希值替换。该文件应类似于以下示例。
    ---
    # This is the internal user database
    # The hash value is a bcrypt hash and can be generated with plugin/tools/hash.sh
    
    _meta:
       type: "internalusers"
       config_version: 2
    
    # Define your internal users here
    
    admin:
       hash: "$2y$1EXAMPLEQqwS8TUcoEXAMPLEeZ3lEHvkEXAMPLERqjyh1icEXAMPLE."
       reserved: true
       backend_roles:
       - "admin"
       description: "Admin user"
    

应用更改

现在已安装 TLS 证书,并已删除演示用户或为其分配了新密码,最后一步是应用配置更改。这最后一步配置需要OpenSearch在主机上运行时调用securityadmin.sh

  1. 启动 OpenSearch。securityadmin.sh必须在 OpenSearch 运行的情况下才能应用更改。
    # Change directories
    cd /path/to/opensearch-3.1.0/bin
    
    # Run the service in the foreground
    ./opensearch
    
  2. 打开一个单独的主机终端会话,并导航到包含securityadmin.sh的目录。
    # Change to the correct directory
    cd /path/to/opensearch-3.1.0/plugins/opensearch-security/tools
    
  3. 调用脚本。有关必须传递的参数定义,请参阅使用 securityadmin.sh 应用更改
    # You can omit the environment variable if you declared this in your $PATH.
    OPENSEARCH_JAVA_HOME=/path/to/opensearch-3.1.0/jdk ./securityadmin.sh -cd /path/to/opensearch-3.1.0/config/opensearch-security/ -cacert /path/to/opensearch-3.1.0/config/root-ca.pem -cert /path/to/opensearch-3.1.0/config/admin.pem -key /path/to/opensearch-3.1.0/config/admin-key.pem -icl -nhnv
    
  4. 停止并重启正在运行的 OpenSearch 进程以应用更改。

验证服务是否正在运行

OpenSearch 现在已在您的主机上运行,并带有自定义 TLS 证书和用于基本身份验证的安全用户。您可以通过从另一台主机向 OpenSearch 节点发送 API 请求来验证外部连接。

在之前的测试中,您将请求定向到localhost。现在已应用 TLS 证书,并且新证书引用了您主机的实际 DNS 记录,指向localhost的请求将无法通过 CN 检查,并且证书将被视为无效。相反,请求应发送到您在生成证书时指定的地址。

在发送请求之前,您应该将根证书的信任添加到您的客户端。如果您不添加信任,则必须使用-k选项,以便 cURL 忽略 CN 和根证书验证。

$ curl https://your.host.address:9200 -u admin:yournewpassword -k
{
  "name" : "hostname-here",
  "cluster_name" : "opensearch",
  "cluster_uuid" : "efC0ANNMQlGQ5TbhNflVPg",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.1.0",
    "build_type" : "tar",
    "build_hash" : "388c80ad94529b1d9aad0a735c4740dce2932a32",
    "build_date" : "2022-06-30T21:31:04.823801692Z",
    "build_snapshot" : false,
    "lucene_version" : "9.2.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org.cn/"
}

使用 systemd 将 OpenSearch 作为服务运行

本节将指导您为 OpenSearch 创建服务并将其注册到systemd。定义服务后,您可以使用systemctl命令启用、启动和停止 OpenSearch 服务。本节中的命令反映了 OpenSearch 已安装到/opt/opensearch的环境,应根据您的安装路径进行更改。

以下配置仅适用于非生产环境中的测试。我们不建议在生产环境中使用以下配置。如果您希望在主机上将 OpenSearch 作为 systemd 管理的服务运行,则应通过RPM分发版安装 OpenSearch。tarball 安装不定义特定的安装路径、用户、角色或权限。未能正确保护您的主机环境可能导致意外行为。

  1. 为 OpenSearch 服务创建一个用户。
    sudo adduser --system --shell /bin/bash -U --no-create-home opensearch
    

  2. 将您的用户添加到opensearch用户组。
    sudo usermod -aG opensearch $USER
    

  3. 将文件所有者更改为opensearch。如果您的 OpenSearch 文件位于不同目录中,请务必更改路径。
    sudo chown -R opensearch /opt/opensearch/
    

  4. 创建服务文件并打开它进行编辑。
    sudo vi /etc/systemd/system/opensearch.service
    

  5. 输入以下示例服务配置。如果您的 OpenSearch 文件位于不同目录中,请务必更改对路径的引用。
    [Unit]
    Description=OpenSearch
    Wants=network-online.target
    After=network-online.target
    
    [Service]
    Type=forking
    RuntimeDirectory=data
    
    WorkingDirectory=/opt/opensearch
    ExecStart=/opt/opensearch/bin/opensearch -d
    
    User=opensearch
    Group=opensearch
    StandardOutput=journal
    StandardError=inherit
    LimitNOFILE=65535
    LimitNPROC=4096
    LimitAS=infinity
    LimitFSIZE=infinity
    TimeoutStopSec=0
    KillSignal=SIGTERM
    KillMode=process
    SendSIGKILL=no
    SuccessExitStatus=143
    TimeoutStartSec=75
    
    [Install]
    WantedBy=multi-user.target
    

  6. 重新加载systemd管理器配置。
    sudo systemctl daemon-reload
    

  7. 启用 OpenSearch 服务。
    sudo systemctl enable opensearch.service
    

  8. 启动 OpenSearch 服务。
    sudo systemctl start opensearch
    

  9. 验证服务是否正在运行。
    sudo systemctl status opensearch