elasticsearch7.8.0,kibana7.8.0安装
目录
Windows下安装Elasticsearch
- 官网下载:https://www.elastic.co/downloads/elasticsearch , elasticsearch-7.8.0-no-jdk-windows-x86_64.zip,要求已经配置JAVA_HOME环境变量
- 单节点安装:解压后直接运行.bat启动,http://localhost:9200/ 访问正常即可
- 多节点安装:如果配置为都可以为master,半数以上可用?
配置参考:
点击查看代码
# ======================== Elasticsearch Configuration ========================= # # NOTE: Elasticsearch comes with reasonable defaults for most settings. # Before you set out to tweak and tune the configuration, make sure you # understand what are you trying to accomplish and the consequences. # # The primary way of configuring a node is via this file. This template lists # the most important settings you may want to configure for a production cluster. # # Please consult the documentation for further information on configuration options: # https://www.elastic.co/guide/en/elasticsearch/reference/index.html # # ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # #cluster.name: my-application cluster.name: my-application # 集群名称 各节点配置的要相同 # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # #node.name: node-1 node.name: node-1002 # # Add custom attributes to the node: # #node.attr.rack: r1 node.master: true # 是否允许为主节点 node.data: true # 是否存储数据 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # #path.data: /path/to/data # # Path to log files: # #path.logs: /path/to/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #bootstrap.memory_lock: true # # Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # #network.host: 192.168.0.1 network.host: localhost # 节点绑定的ip地址 # # Set a custom port for HTTP: # #http.port: 9200 http.port: 1002 # 节点对外提供的http端口 transport.tcp.port: 9302 # 内部tcp端口 # # For more information, consult the network module documentation. # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when this node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # #discovery.seed_hosts: ["host1", "host2"] discovery.seed_hosts: ["localhost:9301","localhost:9302", localhost:9303] # 可以发现的其他节点主机 discovery.zen.fd.ping_timeout: 1m # 节点之间的超时时间 discovery.zen.fd.ping_retries: 5 # 节点之间尝试次数 # # Bootstrap the cluster using an initial set of master-eligible nodes: # #cluster.initial_master_nodes: ["node-1", "node-2"] #cluster.initial_master_nodes: ["node-1001", "node-1002"] # 可以被选为主节点的节点列表 # # For more information, consult the discovery and cluster formation module documentation. # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true # 跨域配置 http.cors.enabled: true http.cors.allow-origin: "*"
Linux下安装Elasticsearch
下载及安装步骤:https://www.elastic.co/guide/en/elasticsearch/reference/7.3/getting-started-install.html
- 单机安装
## 添加es单独的用户,es不允许使用root直接运行 useradd es passwd es # 设置密码 userdel -r es # 该命令可用删除用户 chown -R es:es /opt/module/es # 将es的目录下的所有文件都修改为es用户和es用户组 ## 配置文件修改参考上述配置文件 ## 修改/es/security/limits.conf 每个进程可以打开的文件数限制 增加下面配置 es soft nofile 65536 es hard nofile 65536 * hard nproc 4096 # 操作系统级别对每个用户创建的进程的限制 *表示所有用户 ## 修改/etc/sysctl.conf 一个进程可用拥有的虚拟内存的大小,默认65536 vm.max_map_count=655360 ## 修改后重新加载配置 sysctl -p ## 启动es bin/elasticsearch # 或者bin/elasticsearch -d后台启动,如果启动时显示文件与所属用户不匹配,需要再执行下chown -R es:es /opt/module/es
- 集群下安装其他配置:
docker下安装Elasticsearch
下载镜像文件 docker pull elasticsearch:7.4.2 # 存储和检索数据 docker pull kibana:7.4.1 # 可视化检索数据 创建实例 mkdir -p /mydata/elasticsearch/config mkdir -p /mydata/elasticsearch/data echo "http.host:0.0.0.0">>/mydata/elasticsearch/config/elasticsearch.yml # 保证所有外部都可以访问 docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \ -e "discovery.type=single-node" \ -e ES_JAVA_OPTS="-Xms128m -Xmx256m" \ -v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \ -v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins -d elasticsearch:7.6.2 # 访问端口和内部通信端口 # 单节点 # JVM的配置,不配置会尽可能的占用内存 # 将外部挂载文件和默认路径关联,保持同步 # 注意外部文件夹的权限 # 安装完成后可以访问9200端口 # 其他命令 docker ps docker images ## 安装Kibana docker run --name kibana -e ELASTICSEARCH_HOSTS=http://虚拟机地址:9200 -p5601:5601 -d kibana:7.4.1 ## 安装完成后可以在5601端口访问 ## 或者使用postman个ES发送请求
Kibana安装
需要修改配置:
server.port: 5601 server.host: "127.0.0.1" # 配置es集群url elasticsearch.hosts: ["http://127.0.0.1:9200/"] kibana.index: ".kibana"
chrome ElasticSearch-head插件安装
在谷歌浏览器扩展程序添加解压后的插件即可
---
本文来自博客园,作者:Bingmous,转载请注明原文链接:https://www.cnblogs.com/bingmous/p/15643678.html
分类:
BD
标签:
ElasticSearch
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 我与微信审核的“相爱相杀”看个人小程序副业
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· spring官宣接入deepseek,真的太香了~