首页 > 其他分享 >Elasticsearch7.7修改network.host IP地址 start启动失败及Elasticsearch7的配置项详解

Elasticsearch7.7修改network.host IP地址 start启动失败及Elasticsearch7的配置项详解

时间:2024-09-25 09:20:29浏览次数:3  
标签:network Elasticsearch7.7 默认 Elasticsearch7 elasticsearch 设置 集群 节点 es

一、Elasticsearch7.7修改network.host IP地址 start启动失败

    使用的是最新的Elasticsearch7.7版本,启动后默认是绑到127.0.0.1上的,这肯定不是我们需要的,所以修改配置文件将network.host配置选改成我们的服务器局域网IP地址。Elasticsearch7.7版本安装后配置文件elasticsearch.yml在目录/etc/lasticsearch中,这个目录只允许root权限进行查看和修改。不过修改后再启动es时报错  publish:June 16, 2020 -Tuesday :

user@u007:/$ sudo /etc/init.d/elasticsearch start
[....] Starting elasticsearch (via systemctl): elasticsearch.serviceJob for elasticsearch.service failed because the control process exited with error code.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.
 failed!
user@u04007:/usr/share/elasticsearch$ systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2020-06-15 22:32:18 CST; 15s ago
     Docs: https://www.elastic.co
  Process: 1057423 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (cod
 Main PID: 1057423 (code=exited, status=78)
      CPU: 35.647s

    这是因为the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured,即一个全新的集群,必须指定该集群在第一次选举中应该使用的一组符合主节点条件的节点作为选举配置。至少配置以下三个配置中的任意一个。如下:
cluster.initial_master_nodes:设置一系列符合主节点条件的节点的主机名或IP 地址来引导启动集群。如果手动设置了node.name,还可以设置为此节点的名称。这是7.*新引入的配置项。
discovery.seed_hosts:自动发现设置,配置之后集群的主机之间可以自动发现。对应旧版中的discovery.zen.ping.unicast.hosts,
discovery.seed_providers:基于文件的自动发现设置,配置之后集群的主机之间可以自动发现。对应旧版中的discovery.zen.hosts_provider。

所以第一次更改elasticsearch配置时记得修改发下这些配置,修改后重启即可。

user@53:/opt/elasticsearch$ sudo grep ^[^#] /etc/elasticsearch/elasticsearch.yml
#集群name和node
cluster.name: 007-es
node.name: node01
node.attr.rack: r1
#集群IP地址和端口
network.host: 192.168.1.10
http.port: 9200
#初始化配置节点
cluster.initial_master_nodes: ["node01", "node02", "node03"]
#跨域启用,允许浏览器访问,head 插件也需要这打开这两配置
http.cors.enabled: true
http.cors.allow-origin: "*"

二、Elasticsearch7的配置项详解

cluster.name: elasticsearch
集群名称,es服务会通过广播方式自动连接在同一网段下的es服务,通过多播方式进行通信,同一网段下可以有多个集群,通过集群名称这个属性来区分不同的集群。

node.name: "test"
当前配置所在机器的节点名,你不设置就默认随机指定一个name列表中名字,该name列表在es的jar包中config文件夹里name.txt文件中,其中有很多作者添加的有趣名字。

node.master: true
指定该节点是否有资格被选举成为node(注意这里只是设置成有资格, 不代表该node一定就是master),默认是true,es是默认集群中的第一台机器为master,如果这台机挂了就会重新选举master。

node.data: true
指定该节点是否存储索引数据,默认为true。

index.number_of_shards: 5
设置默认索引分片个数,默认为5片。

index.number_of_replicas: 1
设置默认索引副本个数,默认为1个副本。如果采用默认设置,而你集群只配置了一台机器,那么集群的健康度为yellow,也就是所有的数据都是可用的,但是某些复制没有被分配。

path.conf: /path/to/conf
设置配置文件的存储路径,默认是es根目录下的config文件夹。

path.data: /path/to/data
设置索引数据的存储路径,默认是es根目录下的data文件夹,可以设置多个存储路径,用逗号隔开,例:path.data: /path/to/data1,/path/to/data2

path.work: /path/to/work
设置临时文件的存储路径,默认是es根目录下的work文件夹。

path.logs: /path/to/logs
设置日志文件的存储路径,默认是es根目录下的logs文件夹

path.plugins: /path/to/plugins
设置插件的存放路径,默认是es根目录下的plugins文件夹, 插件在es里面普遍使用,用来增强原系统核心功能。

bootstrap.mlockall: true
设置为true来锁住内存不进行swapping。因为当jvm开始swapping时es的效率 会降低,所以要保证它不swap,可以把ES_MIN_MEM和ES_MAX_MEM两个环境变量设置成同一个值,并且保证机器有足够的内存分配给es。 同时也要允许elasticsearch的进程可以锁住内存,linux下启动es之前可以通过`ulimit -l unlimited`命令设置。

network.bind_host: 192.168.0.1
设置绑定的ip地址,可以是ipv4或ipv6的,默认为127.0.0.1。

network.publish_host: 192.168.0.1
设置其它节点和该节点交互的ip地址,如果不设置它会自动判断,值必须是个真实的ip地址。

network.host: 192.168.0.1
这个参数是用来同时设置bind_host和publish_host上面两个参数。

transport.tcp.port: 9300
设置节点之间交互的tcp端口,默认是9300。

transport.tcp.compress: true
设置是否压缩tcp传输时的数据,默认为false,不压缩。

http.port: 9200
设置对外服务的http端口,默认为9200。

http.max_content_length: 100mb
设置内容的最大容量,默认100mb

http.enabled: false
是否使用http协议对外提供服务,默认为true,开启。

gateway.type: local
gateway的类型,默认为local即为本地文件系统,可以设置为本地文件系统,分布式文件系统,hadoop的HDFS,和amazon的s3服务器等。

gateway.recover_after_nodes: 1
设置集群中N个节点启动时进行数据恢复,默认为1。

gateway.recover_after_time: 5m
设置初始化数据恢复进程的超时时间,默认是5分钟。

gateway.expected_nodes: 2
设置这个集群中节点的数量,默认为2,一旦这N个节点启动,就会立即进行数据恢复。

cluster.routing.allocation.node_initial_primaries_recoveries: 4
初始化数据恢复时,并发恢复线程的个数,默认为4。

cluster.routing.allocation.node_concurrent_recoveries: 2
添加删除节点或负载均衡时并发恢复线程的个数,默认为4。

indices.recovery.max_size_per_sec: 0
设置数据恢复时限制的带宽,如入100mb,默认为0,即无限制。

indices.recovery.concurrent_streams: 5
设置这个参数来限制从其它分片恢复数据时最大同时打开并发流的个数,默认为5。

discovery.zen.minimum_master_nodes: 1
设置这个参数来保证集群中的节点可以知道其它N个有master资格的节点。默认为1,对于大的集群来说,可以设置大一点的值(2-4)

discovery.zen.ping.timeout: 3s
设置集群中自动发现其它节点时ping连接超时时间,默认为3秒,对于比较差的网络环境可以高点的值来防止自动发现时出错。

discovery.zen.ping.multicast.enabled: false
设置是否打开多播发现节点,默认是true。

discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]
设置集群中master节点的初始列表,可以通过这些节点来自动发现新加入集群的节点。

标签:network,Elasticsearch7.7,默认,Elasticsearch7,elasticsearch,设置,集群,节点,es
From: https://blog.csdn.net/weixin_47792780/article/details/142359996

相关文章

  • 日新月异 PyTorch - pytorch 基础: 通过卷积神经网络(Convolutional Neural Networks,
    源码https://github.com/webabcd/PytorchDemo作者webabcd日新月异PyTorch-pytorch基础:通过卷积神经网络(ConvolutionalNeuralNetworks,CNN)做图片分类-通过ResNet50做图片分类的学习(对cifar10数据集做训练和测试),保存训练后的模型,加载训练后的模型并评估指定的......
  • qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed加
    qDebug()<<"QSslSocket="<<QSslSocket::sslLibraryBuildVersionString();qDebug()<<"OpenSSL支持情况:"<<QSslSocket::supportsSsl();打印需要的版本和当前openssl的支持情况如果显示false,不支持就是说明,不支持加密对应下载版本的openssl进行重新编译即可原因......
  • TikTok提示“Network is out of reach”怎么处理?
    当TikTok提示“Networkisoutofreach”时,意味着应用无法连接到互联网。导致这一问题的常见原因包括网络连接不稳定、地理限制或网络设置与应用不兼容等。解决方法有:拔除手机卡、关闭手机定位服务、切换至稳定的海外IP网络等。使用TikTok专用网络也可以帮助解决连接问题,从而......
  • torch.distributed.DistNetworkError: The server socket has failed to listen on an
    解决方案是在torchrun中添加参数--master_port改变masterport。且注意这个参数一定要加在要跑的文件即src/entry_point/train.py之前,否则会被忽略。引用:https://juejin.cn/post/7260668104752775228我的代码是:torchrun--nproc_per_node1--master_port29501-mtraining.......
  • 论文阅读:Unsupervised Representation Learning with Deep Convolutional Generative
    Abstract背景:希望能缩小CNN在监督学习和无监督学习之间成功应用的差距。贡献:引入了一类称为深度卷积生成对抗网络(DCGAN)的CNN。结果:DCGAN在生成器和判别器中都能从对象到场景学习表示层次结构。1.Introduction贡献:提出DCGAN用于图像分类任务,展示其性能对滤波器......
  • 【生成对抗网络GAN】最全的关于生成对抗网络Generative Adversarial Networks,GAN的介
    【生成对抗网络GAN】最全的关于生成对抗网络GenerativeAdversarialNetworks,GAN的介绍!!【生成对抗网络GAN】最全的关于生成对抗网络GenerativeAdversarialNetworks,GAN的介绍!!文章目录【生成对抗网络GAN】最全的关于生成对抗网络GenerativeAdversarialNetworks,GAN的......
  • Network成功接收数据但与控制台打印不一致
    今天尝试和后端进行数据对接时发生了一个匪夷所思的问题(万恶的控制台)描述前端可以给后端正常发送请求,后端可以接收到正确数据并根据业务流程进行处理,但前端使用控制台打印时与后端返回的数据不一致(没关注Network的返回结果)。后端使用Postman发送请求进行测试却一切正常,可以正......
  • CS/INFO 6850 The Structure of Information Networks
    TheStructureofInformationNetworksHomework1CS/INFO6850Fall2024Due6pm,Wednesday,Sept.18,2024Thegoalofthisproblemsetistoprovidepracticeimplementingsomebasicnetworkanalysistechniquesonamoderate-sizednetworkdataset—specif......
  • CS5229 Advanced Computer Networks
    CS5229AdvancedComputerNetworksProgrammingAssignment1Semester1AY2024/251 OverviewInthisprogramming assignment,youwill explore sketch-based algorithms designed to mon- itor network traffic across a high-traffic network link. We......
  • Azure web app has no access to openai private endpoint in virtual network
    题意:"AzureWeb应用无法访问虚拟网络中的OpenAI私有端点。"问题背景:IamtryingtohostawebapplicationsimilartoaprivateChatGPTinstancewithinasecludedvirtualnetwork,ensuringthatthere'snoexternalinternetaccess."我正在尝试在一个隔离的......