【环境搭建】远程服务器搭建ElasticSearch

参考:

非常详细的阿里云服务器安装ElasticSearch过程..._阿里云服务器使用elasticsearch-CSDN博客

服务器平台:AutoDL

注意:

1、切换为非root用户,su 新用户名,否则ES无法启动

2、安装过程中没有出现设置账号密码,但请求时需要鉴权,可以关闭鉴权配置。

config-> elasticsearch.yml-> xpack.security.enabled false

创建索引:

复制代码
curl -X PUT "http://localhost:9200/docs" -H "Content-Type: application/json" -d '
{
  "mappings": {
    "properties": {
      "content": {
        "type": "text"
      }
    }
  }
}'

插入数据:

复制代码
curl -X POST "http://localhost:9200/docs/_doc" -H "Content-Type: application/json" -d '
{
  "content": "干完这个活就出门遛弯"
}'

通过python创建es对象,并且进行bm25检索

python 复制代码
from elasticsearch import Elasticsearch

self.es_client = Elasticsearch("http://127.0.0.1:9200")

dsl = {
            'query': {
                'match': {
                    'content': "想出门遛弯"
                }
            },
            "size": 3
        }

search_result = self.es_client.search(index='docs', body=dsl)

本地kibana怎么连接远程ES

以AutoDL为例

注意:本地kibana和远程服务器上的ES版本号要一致

AutoDL提供的SS H通道。host:127.0.0.1,port: 6006

STEP 1 修改ES的config->elasticresearch.yml, host和port配置

STEP2 修改kibama的config->kibana.yml, 修改对应的es host信息

STEP 3 服务器启动ES,./bin/elasticsearch, 本地启动kibana ./bin/kibana

注意kibana config中server port , 浏览器打开http:localhost:5602

相关推荐
LienJack8 分钟前
我做了一个 AI Agent 学习站
github·agent
黑泽明Coding14 分钟前
使用密钥登录ssh
运维·ssh
J2虾虾22 分钟前
Spring AI Alibaba - Tools
服务器·人工智能·spring
着迷不白44 分钟前
五、文本处理工具+正则表达式
linux·运维·服务器
卡次卡次11 小时前
vibecoding起步注意点:插件、Skills、MCP、Hooks
服务器·数据库·python·oracle
Elastic 中国社区官方博客1 小时前
每次操作一个 API 调用:Elastic Cloud Hosted 如何让大规模部署管理变得可行
大数据·运维·数据库·elasticsearch·搜索引擎·serverless
一点一木1 小时前
🚀 2026 年 5 月 GitHub 十大热门项目排行榜 🔥
人工智能·github·ai编程
和舒貌1 小时前
【无标题】
服务器
江华森2 小时前
Zabbix 6.4 全栈部署与运维完全指南
运维·zabbix
实心儿儿2 小时前
Linux —— 线程控制(2)
linux·运维·服务器