You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

241 lines
6.3 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"部署本机ES服务\n",
"============="
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"基于 Elasticsearch 8.7.0"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 本机单机部署(启动默认安全设)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Elasticsearch 8.7.0"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 首次启动及配置"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"##### 常用启动方式:\n",
"+ 双击 bin 目录中的 elasticsearch.bat\n",
"+ 命令行中启动 elasticsearch.bat\n",
" \n",
"注意:\n",
"+ 不要使用管理员帐号运行命令行es默认不能在root或administrator帐号运行\n",
"+ 最好使用命令行,不要使用 powershell\n",
"+ 首次启动成功启动后会显示帐号密码、kibana Token、集群加入Token等信息需要记录下来因为这些信息只在首次启动时显示。"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"##### 自定义密码\n",
"ES根目录,命令行执行:`.\\bin\\elasticsearch-reset-password --username 用户名 -i` -i 是交互式执行的意思,执行后输入两次相同密码(输入时光标不会动)就行"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"##### 关闭ES, 对配置文件进行修改\n",
"+ 配置内存占用为4G `config/jvm.options` 文件中指定 -Xms4g -Xmx4g\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Kibanan 8.7.0"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"+ 启动 Kibana \n",
"+ 使用 首次启动ES服务时记录帐号信息及 `kibana token` 登陆\n",
"+ 关闭kibana服务打开配置文件进行更改 i18n.locale: \"zh-CN\" 等\n",
" "
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 启动脚本"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"在 \"本机单节点要目录(`D:\\ELK\\8.7.0\\SingleNode`)\"下有一个脚本文件`启动脚本.bat`,可以同时打开两个命令行窗口,分别启动`ES服务`和相应的`kibana服务`"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 本机三节点集群(启用默认安全)\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 文件部署"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"+ 设置集群根文件夹:`D:\\ELK\\8.7.0\\Cluster`\n",
"+ 下载 `Elasticsearch 8.7.0`文件解压并全量复制3分分别为`es-master` `es-node1` `es-node2` \n",
"+ 下载 `Kibana 8.7.0` 文件,解压并存放为 `es-master 同级目录`的 `kibana`"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 设置编辑配置文件"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"+ 所有节点配置集群名cluster.name: study-es-cluster\n",
"+ Master节点node.name: study-es-cluster-master network.host: 127.0.0.1 http.port: 9201\n",
"+ Node1节点node.name: study-es-cluster-node1 network.host: 127.0.0.1 http.port: 9202\n",
"+ Node2节点node.name: study-es-cluster-node2 network.host: 127.0.0.1 http.port: 9203\n",
"+ Kibana: server.port: 5602"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Master 节点操作"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"+ 启动master节点并记录相关信息用户名密码、指纹、kibanaToken等\n",
"+ 自定义 elstic 密码master根目录运行命令行`./bin/elasticsearch-reset-password --username elastic -i`\n",
"+ 信任CA证书(在认证时不易出错):进入 `master根目录/config/cert/certs/` 双击 `http_ca.crt` -> 安装证书 -> 本地计算机 -> 下一步 -> 将所有证书都放入下列存储 -> 浏览 -> 受信任的根证书颁发机构\n",
"+ 创建注册令牌,其它节点加入集群时使用:`./bin/elasticsearch-create-enrollment-token -s node` 记住生成的 Token 备用\n",
"+ 在`config/aelasticsearch.yml`的末尾取消注释`transport.host`设置。如果配置项已自动生成则忽略\n",
"+ 最好重新启动下 master 节点"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 其它节点加入集群"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"在每个要加入集群的节点上都执行:\n",
"+ 在节点根目录执行命令行:./bin/elasticsearch --enrollment-token Master节点生成的token"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### 启动与配置 kibana"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"+ 修改配置 server.port: 5602\n",
"+ 启动kibanan\n",
"+ 使用Master节点首次启动时记录下的 kibana token 登陆过期的话使用下面命令行刷新token ./bin/elasticsearch-create-enrollment-token -s kibana --url \"https://127.0.0.1:9201\"\n",
"+ 关闭Kibana,修改配置文件,变成中文设置 i18n.locale: \"zh-CN\""
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"language_info": {
"name": "polyglot-notebook"
},
"orig_nbformat": 4,
"polyglot_notebook": {
"kernelInfo": {
"defaultKernelName": "csharp",
"items": [
{
"aliases": [],
"name": "csharp"
}
]
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}