单层gmetad高可用

虽然gmetad可以多层,但是层层gmetad都需要开启gweb,还是很麻烦。如果只是担心一个gmetad不安全,可以做成gmetad高可用,但是我还不知道有没有想hadoop ha那样自动failover的办法。

资源安排:

1.

hdp1:gmetad、gmond、gweb

hdp2:gmetad、gmond、gweb

hdp3:gmond

配置目的:

hdp1和hdp2的gmetad、gweb高可用,每个节点的gweb都可以展示整个集群的数据

hdp1、2、3均属于一个集群

配置文件:

hdp3——gmond.conf:

cluster {

  name = "hdp3"

  owner = "unspecified"

  latlong = "unspecified"

  url = "unspecified"

}

 

/* The host section describes attributes of the host, like the location */

host {

  location = "unspecified"

}

 

/* Feel free to specify as many udp_send_channels as you like.  Gmond

   used to only support having a single channel */

udp_send_channel {

  #bind_hostname = yes # Highly recommended, soon to be default.

                       # This option tells gmond to use a source address

                       # that resolves to the machine's hostname.  Without

                       # this, the metrics may appear to come from any

                       # interface and the DNS names associated with

                       # those IPs will be used to create the RRDs.

  #mcast_join = 239.2.11.71

  host = hdp1

  port = 8649

  ttl = 1

}

 

udp_send_channel {

  #bind_hostname = yes # Highly recommended, soon to be default.

                       # This option tells gmond to use a source address

                       # that resolves to the machine's hostname.  Without

                       # this, the metrics may appear to come from any

                       # interface and the DNS names associated with

                       # those IPs will be used to create the RRDs.

  #mcast_join = 239.2.11.71

  host = hdp2

  port = 8649

  ttl = 1

}

 

/* You can specify as many udp_recv_channels as you like as well. */

udp_recv_channel {

  #mcast_join = 239.2.11.71

  #port = 8649

  #bind = 239.2.11.71

  #retry_bind = true

  # Size of the UDP buffer. If you are handling lots of metrics you really

  # should bump it up to e.g. 10MB or even higher.

  # buffer = 10485760

}

 

/* You can specify as many tcp_accept_channels as you like to share

   an xml description of the state of the cluster */

tcp_accept_channel {

  #port = 8649

  # If you want to gzip XML output

  gzip_output = no

}

hdp1——gmond.conf:

cluster {

  name = "hdp3"

  owner = "unspecified"

  latlong = "unspecified"

  url = "unspecified"

}

 

/* The host section describes attributes of the host, like the location */

host {

  location = "unspecified"

}

 

/* Feel free to specify as many udp_send_channels as you like.  Gmond

   used to only support having a single channel */

udp_send_channel {

  #bind_hostname = yes # Highly recommended, soon to be default.

                       # This option tells gmond to use a source address

                       # that resolves to the machine's hostname.  Without

                       # this, the metrics may appear to come from any

                       # interface and the DNS names associated with

                       # those IPs will be used to create the RRDs.

  #mcast_join = 239.2.11.71

  host = hdp1

  port = 8649

  ttl = 1

}

 

udp_send_channel {

  #bind_hostname = yes # Highly recommended, soon to be default.

                       # This option tells gmond to use a source address

                       # that resolves to the machine's hostname.  Without

                       # this, the metrics may appear to come from any

                       # interface and the DNS names associated with

                       # those IPs will be used to create the RRDs.

  #mcast_join = 239.2.11.71

  host = hdp2

  port = 8649

  ttl = 1

}

 

 

/* You can specify as many udp_recv_channels as you like as well. */

udp_recv_channel {

  #mcast_join = 239.2.11.71

  port = 8649

  #bind = 239.2.11.71

}

 

/* You can specify as many tcp_accept_channels as you like to share

   an xml description of the state of the cluster */

tcp_accept_channel {

  port = 8649

}

 

hdp1——gmetad.conf:

[root@hdp1 ganglia]# grep -v ^# gmetad.conf 

 data_source "hdp3" localhost

 RRAs "RRA:AVERAGE:0.5:1:244" "RRA:AVERAGE:0.5:24:244" "RRA:AVERAGE:0.5:168:244" "RRA:AVERAGE:0.5:672:244"

 gridname "HDP" 

 all_trusted on

setuid_username ganglia

 xml_port 8651

 interactive_port 8652

case_sensitive_hostnames 0

 

hdp2——gmond.conf:

效仿hdp1的配置即可

 

效果达到配置目的

2.

hdp1、2、3分属3个集群,hdp1、2为gmetad高可用

则原理为:hdp1、2分别用gmetad去轮询hdp1、2、3的gmond节点(生产中的汇聚节点)

所需配置与单gmetad无异,gmetad复制一份到备份gmetad节点即可

原文地址:https://www.cnblogs.com/roger888/p/5576355.html