您将需要一个正常运行的 Elasticsearch 安装 - 类似于我们在 下载和安装 Elasticsearch 第 1 章, 开始 .
必须安装 Python 版本 3.4, 或更高版本才能运行 ElasticSearch HQ。
如果您使用 Docker Compose(位于 ch01 目录中的 Docker Compose 进行安装,则无需手动安装。
为了安装 ElasticSearch HQ,您需要手动下载并安装它。然后,我们将执行以下步骤:
- You can download a ZIP file or tar.gz distribution of ElasticSearch HQ at https://github.com/ElasticHQ/elasticsearch-HQ/releases. For Linux or macOSX, we can use the following command:
- Now you can extract it, using the following command:
- Now you can execute it, using the following commands:
- In the console, you should see the following output:
- To access the web interface, you will need to navigate, using your browser, to the following address:
ElasticSearch HQ 是一个现代反应式应用程序。它由一个使用 Flask 框架 (http://flask.pocoo.org/) 的 Python 编写的后端和一个 SPA 前端组成它是使用 AngularJS 用 JavaScript 编写的。
默认情况下,ElasticSearch HQ 绑定到端口 5000。您可以使用浏览器导航到http://0.0.0.0:5000 地址,以便 查看以下起始页面:
在开始页面上,您可以选择预定义的主机,也可以手动插入 Elasticsearch 服务器的地址。在这种情况下,我的实例能够建议我已经使用过的集群。
点击 Connect 后,如果一切正常,您可以访问 ElasticHQ 主页,显示您的 Nodes 视图和 Indices 视图,如下图所示:
ElasticHQ 主页提供了您的集群和数据的广泛概览;从上到下,我们有以下内容:
- The menu on the top-right: Here, you can choose from the following options:
- Indices: This allows you to perform actions on the indices (such as alias, restore, open, or close)
- Metrics: This offers you metrics about the cluster
- Nodes: This is a list of nodes that you can use to check node information or the state of a node
- Diagnostics: This is a page that provides checks on common Elasticsearch parameters
- REST: This allows you to execute test REST calls
- Query: This allows you to execute searches on the data
- Counters: These display the more important items of the cluster, such as Nodes, Indices, Documents, and the Size of the data
- A line that displays the status of the number of shards
- The list of Nodes
- The list of Indices: The color on the left-side refers to the index state (yellows means that some replicas are missing)
如果您访问 Indices |索引摘要菜单,然后您将被带到索引概览页面,如下所示:
正如您从前面的屏幕截图中看到的,只需单击一个按钮即可执行许多有用的操作:
- Refresh: This is to refresh the indices in order to speed up the search of new items, without waiting for the automatic refresh
- Force Merge: This button reduces the index segments
- Flush: This writes all the index data onto a disk
- Clear Cache: This frees the memory
- Expunge Deleted: This executes a fast force merge that only removes deleted segments
- Create Index: This adds a new index
- Re-Index: This moves data between the indices
通过选择索引名称,您可以访问该特定索引及其操作的信息:
从此视图中,您可以访问更多索引详细信息,如下所示:
- Metrics (the default page): This provides metrics level information
- Shards: This provides details about the shards
- Alias: This allows you to manage the alias for the current index
- Mappings: This allows you to view the mappings
- Administration: This allows you to execute administrative commands only on this index
索引管理视图显示在以下屏幕截图中:
如果您需要了解服务器负载或监控 Elasticsearch KPI,则可以使用 Metrics 按钮访问实时图表:
要监控节点的配置和参数,您可以从 Nodes 菜单访问详细信息:
ElasticHQ 是唯一的用户界面(UI) 提供了一个 Diagnostic 页面,该页面收集所有节点信息并使用颜色标记它们的状态。此页面可通过 Diagnostic 按钮访问:
ElasticSearch HQ 的另一个有用功能是能够从 REST 按钮调用 Elasticsearch 的所有 REST 条目。只需单击一个链接,就可以执行相关的 REST 条目:
ElasticHQ 还提供了一个有用的 REST 接口来测试您的查询:
对于每个 ElasticSearch 用户来说,ElasticSearch HQ 是一个很好的 UI,它提供了许多有助于 Elasticsearch 日常维护和监控的功能。