首页 > 其他分享 >elasticsearch安装head插件

elasticsearch安装head插件

时间:2024-10-24 15:17:44浏览次数:3  
标签:node 插件 head elasticsearch usr grunt local

当我们安装elasticsearch时,需要注意一下问题

  1. 优化配置
    以下是如何通过jvm.options文件设置堆大小的示例:
-Xms2g 
-Xmx2g

将最小堆大小(Xms)和最大堆大小(Xmx)设置为彼此相等
设置Xmx为不超过物理RAM的50%,以确保有足够的物理RAM用于内核文件系统缓存 但是不能超过32g,超过32g java指针将不是压缩的,反而会慢
锁住swap,这会影响es性能(或者修改elasticsearch.yml 添加配置bootstrap.memory.lock)

  1. 当开启 bootstrap.memory.lock: TURE
    启动报错:
memory locking requested for elasticsearch process but memory is not locked

之后重启,还是报上面的错误。以为没配好,之后又改了n次。还是不行。
然后查资料,果然,配置文件不一样了。。
limits.conf这里的配置,只适用于通过PAM认证登录用户的资源限制,它对systemd的service的资源限制不生效。登录用户的限制,通过 /etc/security/limits.conf 来配置
对于systemd service的资源限制,现在放在 /etc/systemd/system.conf 和 /etc/systemd/user.conf
这两个文件里面了。
主要就是/etc/systemd/system.conf这个文件

然后修改下面几项:

DefaultLimitNOFILE=65536
DefaultLimitNPROC=32000
DefaultLimitMEMLOCK=infinity

注意把注释行去掉

安装elasticsearch5.0

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.0.tar.gz
tar xf elasticsearch-5.0.0.tar.gz
mv elasticsearch-5.0.0 /usr/local/elasticsearch
mkdir -pv /data/elasticsearch/{data,logs}
useradd elasticsearch
chown -R elasticsearch.elasticsearch /data/elasticsearch
chown -R elasticsearch.elasticsearch /usr/local/elasticsearch/

修改配置文件

cat /usr/local/elasticsearch/config/elasticsearch.yml |grep -v "^#" |grep -v "^$"
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/logs
network.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"

修改系统参数

cat /etc/security/limits.conf |grep -v "^#" |grep -v "^$"
*              soft    nproc          65536
*              hard    nproc          65536
*              soft    nofile          65536
*              hard    nofile          65536

启动es

su - elasticsearch -c "/usr/local/elasticsearch/bin/elasticsearch &"

安装elasticsearch-head插件

下载

wget https://github.com/mobz/elasticsearch-head/archive/master.zip

安装node环境

wget https://nodejs.org/dist/v10.15.0/node-v10.15.0-linux-x64.tar.xz
mv node-v10.15.0-linux-x64 /usr/local/node

添加node环境变量

vim /etc/profile

添加:

export NODE_HOME=/usr/local/node
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile
[root@elas src]# node -v
v10.15.0

[root@elas src]# npm -v
6.4.1

安装grunt(grunt是基于Node.js的项目构建工具,可以进行打包压缩、测试、执行等等工作,elasticsearch-head插件就是通过grunt启动的)

[root@elas src]# cd elasticsearch-head-master/
[root@elas elasticsearch-head-master]# npm install -g grunt-cli
/usr/local/node/bin/grunt -> /usr/local/node/lib/node_modules/grunt-cli/bin/grunt
+ [email protected]
added 152 packages from 122 contributors in 22.183s

[root@elas elasticsearch-head-master]# grunt -version
grunt-cli v1.3.2

修改elasticsearch-head-master下Gruntfile.js配置文件,添加hostname: '*',
                connect: {
                        server: {
                                options: {
                                        hostname: '*',
                                        port: 9100,
                                        base: '.',
                                        keepalive: true
                                }

安装cnpm

[root@elas elasticsearch-head-master]# npm install -g cnpm --registry=https://registry.npm.taobao.org
npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
/usr/local/node/bin/cnpm -> /usr/local/node/lib/node_modules/cnpm/bin/cnpm
+ [email protected]
added 679 packages from 898 contributors in 16.873s

继续执行

yum install bzip2 -y
cnpm install

修改 elasticsearch.yml

添加以下几行

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-credentials: true
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

重启elasticsearch

安装完成后没有报错的话启动elasticsearch-head-master

grunt server &

当执行 cnpm install时候报错解决:

Get /binary-mirror-config/latest from https://registry.npm.taobao.org error: ConnectionTimeoutError: Connect timeout for 5000ms, GET https://registry.npmjs.com/binary-mirror-config/latest -2 (connected: false, keepalive socket: false, agent status: {"createSocketCount":4,"createSocketErrorCount":0,"closeSocketCount":4,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":0,"freeSockets":{},"sockets":{},"requests":{}}, socketHandledRequests: 1, socketHandledResponses: 0)……

然后找到报错根源:
/nodejs/lib/node_modules/cnpm/node_modules/urllib/lib/urllib.js
修改掉文件里面的常量 TIMEOUT、TIMEOUTS 的 5s 为 10s

标签:node,插件,head,elasticsearch,usr,grunt,local
From: https://blog.csdn.net/qq_40477248/article/details/143210284

相关文章

  • IDEA久违了!FeignX插件支持方法级别的导航跳转
    需求调研:发现身边的同事追踪业务代码的时候,如果遇见feign接口,大家都是通过全局搜url进一步找到远程服务的实现。一旦项目大起来,路径变得复杂甚至重名之后,这将会是灾难。市面上并没有很好的IDEA插件支持feign接口的解析以及相对应的远程服务之间的跳转,因此本人([lyflexi](https:......
  • 在K8S中,什么是 Headless Service?
    在Kubernetes(K8s)中,HeadlessService(无头服务)是一种特殊类型的服务发现机制,它允许用户直接访问集群中的Pod实例,而不是通过Service的负载均衡机制转发到某个具体的Endpoint(Pod)。以下是对HeadlessService的详细解析:1.定义与特点定义:HeadlessService是一种特殊类型的Service,其sp......
  • 在K8S中,常用的CNI网络插件有哪些?并说一下它们的工作原理和区别。
    在Kubernetes(K8s)中,常用的CNI(ContainerNetworkInterface)网络插件包括Flannel、Calico、Weave、Cilium等。这些插件的工作原理和区别如下:1.工作原理CNI是容器网络接口,它是一个标准的通用的接口,用于连接容器管理系统和网络插件。容器runtime为容器提供networknamespace,网络插件......
  • Elasticsearch快速入门(3)
    Elasticsearch快速入门(3)文章目录Elasticsearch快速入门(3)1.数据聚合1.1.聚合的种类1.2.DSL实现聚合1.2.1.Bucket聚合语法1.2.2.聚合结果排序1.2.3.限定聚合范围1.2.4.Metric聚合语法1.2.5.小结1.3.RestAPI实现聚合1.3.1.API语法1.3.2.业务需求1.3.3.业务实现2.自......
  • Elasticsearch快速入门(2)
    Elasticsearch快速入门(2)文章目录Elasticsearch快速入门(2)前言一.DSL查询文档1.DSL查询分类2.全文检索查询2.1.使用场景2.2.基本语法2.3.示例2.4.总结3.精准查询3.1.term查询3.2.range查询3.3.总结4.地理坐标查询4.1.矩形范围查询4.2.附近查询5.复合查询5.1.相关......
  • ElasticSearch配置文件解读
    elasticsearch的config文件夹里面有一个主配置文件:elasticsearch.yml是es的基本配置文件。下面主要讲解下elasticsearch.yml这个文件中可配置的东西。源文件#========================ElasticsearchConfiguration=========================##NOTE:Elasticsearchcom......
  • Elasticsearch 在linux部署 及 Docker 集群部署详解案例示范
    1.在CentOS上安装和配置Elasticsearch在CentOS系统下,安装Elasticsearch主要分为以下步骤:1.1准备工作在开始安装之前,确保你的系统满足以下基本条件:CentOS版本要求:推荐使用CentOS7及以上版本。Java环境:Elasticsearch依赖于Java运行时环境(JRE)。需要确......
  • EyouCms破解版【EyouCms破解授权】去版权插件
    EyouCms:强大的PHP内容管理系统EyouCms是一款基于TP5.0框架开发的免费且开源的企业内容管理系统。它以其持续的维护更新和修补漏洞的能力,在PHP内容管理系统市场中独树一帜。该系统不仅适用于搭建网站,还能轻松构建商城、小程序等多种互联网业务平台。得益于其丰富的线上模板和插件......
  • jenkins中使用Config File Provider Plugin(Config File Provider)插件灵活配置maven
    比之前的https://www.cnblogs.com/dannylinux/p/12622237.html更灵活,不需要改服务器配置文件ConfigFileProviderPlugin插件,新版本jenkins中插件名也叫:ConfigFileProvider安装:1、如果Jenkins服务器有连公网,就直接在线安装。2、如果jenkins服务器没有连公网,可以先在有公网......
  • 我最常用的几个免费爬虫软件&插件,非常强大
    网络爬虫是一种常见的数据采集技术,你可以从网页、APP上抓取任何想要的公开数据,当然需要在合法前提下。爬虫使用场景也很多,比如:搜索引擎机器人爬行网站,分析其内容,然后对其进行排名,比如百度、谷歌价格比较网站,部署机器人自动获取联盟卖家网站上的价格和产品描述,比如什么值得买......