hive+haproxy+keepalived高可用配置

1、haproxy主

[root@csslave03 ~]# cat/etc/haproxy/haproxy.cfg

#---------------------------------------------------------------------

# Example configuration for a possible webapplication.  See the

# full configuration options online.

#

#   http://haproxy.1wt.eu/download/1.4/doc/configuration.txt

#

#---------------------------------------------------------------------

 

#---------------------------------------------------------------------

# Global settings

#---------------------------------------------------------------------

global

   log         127.0.0.1 local2

   chroot      /var/lib/haproxy

   pidfile     /var/run/haproxy.pid

   maxconn     5000

   user        haproxy

   group       haproxy

   daemon

    #turn on stats unix socket

   stats socket /var/lib/haproxy/stats

 

#---------------------------------------------------------------------

# common defaults that all the 'listen' and'backend' sections will

# use if not designated in their block

#---------------------------------------------------------------------

defaults

       mode tcp                       

       retries 2                      

       option redispatch              

       option abortonclose         

       maxconn 1024                 

       timeout connect 1d          

       timeout client 1d              

       timeout server 1d             

       timeout check 2000          

       log 127.0.0.1 local0 err #[err warning info debug]

#---------------------------------------------------------------------

# listen

#---------------------------------------------------------------------

listen admin_stats               

       bind 0.0.0.0:1090         

       mode http                 

       maxconn 20                            

       stats refresh 30s         

       stats uri /               

       stats realm Hive\ Haproxy 

       stats auth admin:bigdata  

 

#---------------------------------------------------------------------

# static backend for serving up images,stylesheets and such

#---------------------------------------------------------------------

listen hive                                                                               

       bind 0.0.0.0:80                                                 

       mode tcp                                                          

       balance leastconn                                                 

       maxconn 1024                                                      

       server hive_1 192.168.*.*:10000 check inter 180000 rise 1 fall 2

       server hive_2 192.168.*.*:10000 check inter 180000 rise 1 fall 2

[root@csslave03 ~]# cat/etc/keepalived/keepalived.conf

! Configuration File for keepalived

 

global_defs {

  notification_email {

    yujinga@qq.com

   }

  notification_email_from Alexandre.Cassen@firewall.loc

  smtp_server smtp.qq.com

  smtp_connect_timeout 30

  router_id LVS_DEVEL

}

 

vrrp_script chk_haproxy {

       script "/root/haproxy.sh"

       weight -20

       interval 2                                    

}

 

vrrp_instance VI_1 {

   state MASTER

   interface eth0

   virtual_router_id 51

   priority 110

   advert_int 1

   track_script {

       chk_haproxy

    }

   authentication {

       auth_type PASS

       auth_pass 1111

    }

   virtual_ipaddress {

       192.168.*.*

    }

   notify_master /root/haproxy_master.sh

}

[root@csslave03 ~]# cat haproxy.sh

#!/bin/bash

A=`ps -C haproxy --no-header |wc -l`

#a=`ps -ef | grep haproxy| grep -v grep |wc-l`

if [ $A == 0 ]

   then

       /etc/init.d/keepalived stop

       echo "haproxy is down,stoping keepalive..."

   exit

fi

[root@csslave03 ~]# cat haproxy_master.sh

#!/bin/bash

sleep 3

/etc/init.d/haproxy reload && echo"haproxy is reload........"

2、haproxy从

haproxy主配置文件

[root@csslave04 ~]# cat/etc/haproxy/haproxy.cfg

#---------------------------------------------------------------------

# Example configuration for a possible webapplication.  See the

# full configuration options online.

#

#  http://haproxy.1wt.eu/download/1.4/doc/configuration.txt

#

#---------------------------------------------------------------------

 

#---------------------------------------------------------------------

# Global settings

#---------------------------------------------------------------------

global

   log         127.0.0.1 local2

   chroot      /var/lib/haproxy

   pidfile     /var/run/haproxy.pid

   maxconn     5000

   user        haproxy

   group       haproxy

    daemon

    #turn on stats unix socket

   stats socket /var/lib/haproxy/stats

 

#---------------------------------------------------------------------

# common defaults that all the 'listen' and'backend' sections will

# use if not designated in their block

#---------------------------------------------------------------------

defaults

       mode tcp                       

       retries 2                      

       option redispatch              

       option abortonclose         

       maxconn 1024                 

       timeout connect 1d          

       timeout client 1d              

       timeout server 1d             

       timeout check 2000          

       log 127.0.0.1 local0 err #[err warning info debug]

#---------------------------------------------------------------------

# listen

#---------------------------------------------------------------------

listen admin_stats               

       bind 0.0.0.0:1090         

       mode http                 

       maxconn 20                            

       stats refresh 30s         

       stats uri /               

       stats realm Hive\ Haproxy 

       stats auth admin:bigdata  

 

#---------------------------------------------------------------------

# static backend for serving up images,stylesheets and such

#---------------------------------------------------------------------

listen hive                                                                               

       bind 0.0.0.0:80                                                 

       mode tcp                                                          

       balance leastconn                                                 

       maxconn 1024                                                       

       server hive_1 192.168.*.34:10000 check inter 180000 rise 1 fall 2

       server hive_2 192.168.*.42:10000 check inter 180000 rise 1 fall 2

                  

haproxy主keepalived配置文件

[root@csslave04 ~]# cat/etc/keepalived/keepalived.conf

! Configuration File for keepalived

 

global_defs {

  notification_email {

    yujinga@qq.com

   }

  notification_email_from Alexandre.Cassen@firewall.loc

  smtp_server smtp.qq.com

  smtp_connect_timeout 30

  router_id LVS_DEVEL

}

 

vrrp_instance VI_1 {

   state BACKUP

   interface eth0

   virtual_router_id 51

   priority 100

   advert_int 1

   authentication {

       auth_type PASS

       auth_pass 1111

    }

   virtual_ipaddress {

       192.168.*.*

    }

   notify_master /root/haproxy_master.sh

}

检查脚本      

[root@csslave04 ~]# cat haproxy_master.sh

#!/bin/bash

sleep 3

/etc/init.d/haproxy reload && echo"haproxy is reload........"

[root@csslave04 ~]#

3、cloudera管理页面配置


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Hive是一个基于Hadoop的数据仓库基础设施,它提供了类似于SQL的查询语言HiveQL来查询和分析存储在Hadoop集群中的大规模数据。Hive可以将结构化的数据映射到Hadoop的分布式文件系统上,并提供了数据的查询和分析能力。 关于hive+archive的问题,根据提供的引用内容,我无法确定具体的问题。但是,如果你想了解如何在Hive中使用archive文件,我可以给你提供一些相关信息。 在Hive中,archive文件是一种压缩文件格式,它可以将多个文件或目录打包成一个文件。Hive提供了ARCHIVE命令来创建和管理archive文件。你可以使用ARCHIVE命令将Hive表中的数据打包成archive文件,然后将其存储在Hadoop分布式文件系统中。 以下是使用ARCHIVE命令创建archive文件的示例: ```sql -- 创建archive文件 ARCHIVE TABLE table_name TO 'hdfs://path/to/archive/file/archive_file_name.har'; ``` 在上面的示例中,table_name是要打包的Hive表的名称,'hdfs://path/to/archive/file/archive_file_name.har'是archive文件的存储路径和文件名。 你还可以使用UNARCHIVE命令解压缩archive文件: ```sql -- 解压缩archive文件 UNARCHIVE TABLE table_name; ``` 在上面的示例中,table_name是要解压缩的Hive表的名称。 请注意,archive文件只能用于Hive表的数据,而不包括表的元数据。因此,在解压缩archive文件后,你需要使用CREATE TABLE语句重新创建表的元数据。 希望以上信息对你有帮助。如果你有任何进一步的问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值