首页 > 编程知识 正文

elasticsearch语法,elasticsearch 详解

时间:2023-05-05 02:23:43 阅读:147049 作者:1065

文章目录创建独立安装准备用户文件修改解压缩配置服务启动服务验证问题安装elasticsearch-head安装代理下载镜像启动容器连接测试问题解决方案

准备独立安装安装jdk1.8安装并设置网络环境以关闭防火墙准备安装文件elasticsearch-6.5.4.tar.gz创建用户elsearch用户Elasticsearch不支持根用户运行和解压缩useradd elsearch文件

用root解压缩安装文件,更改配置

tar-xvfelasticsearch-6.5.4.tar.gz

解压缩后,文件目录的所有者将是elsearch

chownelsearch :电子商务-6.5.4- r

目录结构如下

[根@ localhost~] # CD/opt/apps/[根@ localhost apps ] # ll总用量297928 drwxr-xr-x.9 elsearchelsearch 1556月23日15336043 elastic search-6.5.4-rw-r-- r-.1root root 1133226499999 5336032 El search-elastic search-6.5.4 lrwxrwxrwx.1根路由13月23日14333 /drwxr-xr-x. 7 10 143 245 10月6日2018 JDK1.8. 0

vim conf/elasticsearch.yml

通过设置network.host:0.0.0#IP地址,可以从任何网络访问

#说明:如果network.host不是localhost或127.0.0.1,则Elasticsearch会将其视为生产环境。

对环境要求较高,我们的测试环境并不一定令人满意,一般需要修改以下两处结构:

#1:更改JVM启动参数

vim conf/jvm.options

-根据-Xms128m #本机的状况进行修正

-Xmx128m

#2)一个进程在虚拟内存区域(VMAs )中创建最大内存映射数

vim /etc/sysctl.conf

vm.max_map_count=655360

将启用sysctl -p #配置

启动服务su elsearch切换为elsearch用户启动服务

在cd thddp./elasticsearch或./elasticsearch -d #后台启动服务验证

如果问题解决启动后无法访问上述页面,则服务启动过程可能存在问题。 请确认。 logs目下的日志文件根据错误报告内容进行配置修正

[1] : maxfiledescriptors [ 4096 ] forelasticsearchprocessistoolow,increase to atleast [65536]

#解决方案:切换到root用户,然后编辑limits.conf添加以下内容

vi /etc/security/limits.conf

添加以下内容:

* soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096电子搜索头es公式没有为es提供接口管理工具,而是在后台elasticsearch-head是为ES开发的页面客户端工具。 可以轻松操作ES

安装docker环境在linunx或windows环境中安装docker并配置镜像加速器

windows7环境的配置镜像将按以下方式加速:

docker-machinesshdefaultsudosed-I ' s|extra _ args=' | extra _ args='-- registry-mirror=https://uq 95 oor2. mir rror profileexitdocker-machinerestartdefault下载镜像docker @ deror elastic search-head 336053360 pullingfabz/elastic search-head 33605360 elastic search-head 75 a 822 CD 78883360 pull complete 57 de 64 c 722673360 pull complete 4306 be1 e 894333: pull comple 完成871436 ab 722253360 pulete 26a 367 a 3360 pull complete1f 04 Fe 713 f1 b : pull complete 723 BAC 39028 e 3: pull complete 7d 8cb 47 f1 c 603: c 4233333333333: eteb 451 F2 CCF B9 a : pull complete 304 D5 c 28 a4 cf : pull complete4cf 804850 db 1: pull completedigest 3360 sha 2560 d 85 de0DC 9719 F9 d 97 a 2f 33 baa 320223 f 34 status : downloadednewerimageformobz/elastic search-head 33605 docker.io/mobz/elasticsearch-head:5启动容器docker create---nameelasticsearch-head-p 910033609100 mobz/elastic search-head :5 docker @ default :~$ dockerpscontaineridimagecommandcreatedstatusportsnamesdocker @ default 336660 RTS names 535141 c 53cf7mobz/elastic search-head 33605 '/th DDP/sh -c 'grunt s钬12 secondsagocreatedelasticsearch-head docker @ default :~$ dockerstartelasticsearch-headelasticsearad dcreatedstatusportsnames 535141 c 53cf7mobz/elastic search-head :5 '/th DDP/sh-c ' grunt s钬35 secondsagoup5seconds 0 将以下内容添加到TCPelasticsearch-head编辑配置文件elasticsearch.yml中,然后重新启动es

[ root @ localhost config ] # vielasticsearch.yml . http.CORS.enabled 3360 true http.CORS.allow-origin 3360 ' * ' '

问题解决创建ElasticSearch-Head索引没有响应,并且在F12检查中发现406个错误。

更改head的内容类型设置。

docker exex -it容器id /thddp/bash

root @ b 93 fa4e29 ba 2:/usr/src/app # vim _ site/vendor.js

686行/content type : ' application/x-www-form-urlencoded

内容类型:“APP/JSON; charset=UTF-8”7574行现代故事inspect data=s.content type==' application/x-www-form-urlencoded '

现代故事inspect data=s.content type===" application/JSON; charset=UTF-8 "

root @ b 93 fa4e29 ba 2:/usr/src/app/_ site # exit

退出

[ root @ localhost~] # docker restart容器id

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。