HAproxy

HaProxy安装和常用命令.md

你离开我真会死。 提交于 2020-01-17 00:39:43
安装haproxy 对于 haproxy 安装,网上有大量的资源可以参考,最常见的是使用 yum 和 编译安装两种方式。 yum 安装 haproxy CentOS自带了haproxy,但可能版本比较老。可以在IUS源上找到稳定版的haproxy。 主要步骤如下: (1)配置yum源 cat <<eof>/etc/yum.repos.d/ius-7.repo [ius] name = IUS for Enterprise Linux 7 - $basearch baseurl = https://repo.ius.io/7/$basearch/ enabled = 1 repo_gpgcheck = 0 gpgcheck = 1 gpgkey = https://repo.ius.io/RPM-GPG-KEY-IUS-7 [ius-debuginfo] name = IUS for Enterprise Linux 7 - $basearch - Debug baseurl = https://repo.ius.io/7/$basearch/debug/ enabled = 0 repo_gpgcheck = 0 gpgcheck = 1 gpgkey = https://repo.ius.io/RPM-GPG-KEY-IUS-7 [ius-source] name = IUS

Can't access websocket (ws://) url using marathon-lb

家住魔仙堡 提交于 2020-01-16 18:05:50
问题 I have a container running a jupyter gateway which requires two urls to be accessible a http and websocket url. On localhost, for example, these urls are http://127.0.0.1:8888 and ws://127.0.0.1:8888 . When I start my app with marathon and ssh into the mesos slave running the container I can access both of these urls functionality using my client that makes requests to the jupyter gateway. Which tells me the jupyter gateway in the container is working fine. However when I am trying to access

Can't access websocket (ws://) url using marathon-lb

蓝咒 提交于 2020-01-16 18:05:03
问题 I have a container running a jupyter gateway which requires two urls to be accessible a http and websocket url. On localhost, for example, these urls are http://127.0.0.1:8888 and ws://127.0.0.1:8888 . When I start my app with marathon and ssh into the mesos slave running the container I can access both of these urls functionality using my client that makes requests to the jupyter gateway. Which tells me the jupyter gateway in the container is working fine. However when I am trying to access

HAProxy+keepalived+MySQL 实现MHA中slave集群负载均衡的高可用

我与影子孤独终老i 提交于 2020-01-16 07:29:48
HAProxy+keepalived+MySQL实现MHA中slave集群的负载均衡的高可用 Ip地址划分: 240 mysql_b2 242 mysql_b1 247 haproxy1 249 haproxy2 243 VIP 248 client 1、安装HAProxy yum install gcc -y make TARGET=linux26 PREFIX=/usr/local/haproxy make install PREFIX=/usr/local/haproxy cp /usr/src/haproxy/haproxy-1.5.3/examples/haproxy.cfg /usr/local/haproxy/ cp /usr/src/haproxy/haproxy-1.5.3/examples/haproxy.init /etc/init.d/haproxy chmod 755 /etc/init.d/haproxy ln -s /usr/local/haproxy/sbin/* /usr/sbin/ mkdir /etc/haproxy mkdir /usr/share/haproxy ln -s /usr/local/haproxy/haproxy.cfg /etc/haproxy/ cd .. 1.2 设置配置文件 1.2.1 拷贝配置文件 [root

使用docker搭建mysql集群

懵懂的女人 提交于 2020-01-16 05:50:15
使用docker搭建mysql集群 如何使用docker搭建mysql的集群(使用了percona/percona-xtradb-cluster和haproxy镜像) 获取docker的mysql镜像 获取docker仓库存在的mysql镜像 docker pull percona/percona-xtradb-cluster:latest #获取镜像 #也可使用docker tag 【镜像名称】 【你需要的命名】 ,来个镜像加标签,可以让镜像名字短一些,便于使用 创建mysql集群服务 新建属于mysql集群的网段 docker network create -- subnet=172 . 18 . 0 . 0 / 16 mysql - cluster - net 新建属于mysql服务的数据卷 docker volume create v1 docker volume create v2 docker volume create v3 docker volume create v4 docker volume create v5 创建第一个mysql的节点 docker run - d - p 3406:3306 - e MYSQL_ROOT_PASSWORD=Radiant123 - e CLUSTER_NAME=MIXEDINFOS - PXC - e XTRABACKUP

How can we achieve route requests to postgres master using HAproxy

梦想与她 提交于 2020-01-15 10:25:23
问题 I am trying to setup a load balancing for postgres database. We have a postgres master and slave. I configured HA proxy to achieve load balancing. Simple load balancing is working fine. This database is used for bitbucket. When bitbucket is writing data to database over the loadbalancer it is fine if it is hitting master, but problem encounters when it is hitting slave(which is in read mode) as it cant update the database. How can i say HAproxy to route requests to postgres master. Select *

[转]如何正确设置nginx中remote_addr和x_forwarded_for参数

删除回忆录丶 提交于 2020-01-15 00:07:05
做网站时经常会用到 remote_addr 和 x_forwarded_for 这两个头信息来获取客户端的IP,然而当有反向代理或者CDN的情况下,这两个值就不够准确了,需要调整一些配置。 什么是remote_addr remote_addr代表客户端的IP,但它的值不是由客户端提供的,而是服务端根据客户端的ip指定的,当你的浏览器访问某个网站时,假设中间没有任何代理,那么网站的web服务器(Nginx,Apache等)就会把remote_addr设为你的机器IP,如果你用了某个代理,那么你的浏览器会先访问这个代理,然后再由这个代理转发到网站,这样web服务器就会把remote_addr设为这台代理机器的IP。 什么是x_forwarded_for 正如上面所述,当你使用了代理时,web服务器就不知道你的真实IP了,为了避免这个情况,代理服务器通常会增加一个叫做x_forwarded_for的头信息,把连接它的客户端IP(即你的上网机器IP)加到这个头信息里,这样就能保证网站的web服务器能获取到真实IP 使用HAProxy做反向代理 通常网站为了支撑更大的访问量,会增加很多web服务器,并在这些服务器前面增加一个反向代理(如HAProxy),它可以把负载均匀的分布到这些机器上。你的浏览器访问的首先是这台反向代理,它再把你的请求转发到后面的web服务器

How to run stats in HAProxy 1.6.4 on same port as frontend?

风格不统一 提交于 2020-01-14 09:22:20
问题 I'm using HAProxy 1.6.4 and want to enable the stats. (/haproxy?stats) Here is my cfg: global log 127.0.0.1 local2 daemon maxconn 256 defaults log global timeout connect 5000 timeout client 10000 timeout server 10000 frontend http-in bind *:8080 default_backend testb backend testb balance roundrobin server s1 123.456.789.0:443 maxconn 32 server s2 123.456.789.1:443 maxconn 32 listen statistics bind *:8080 mode http stats enable If I run statistics on other port than 8080 it works, but how can

Haproxy ssl redirect handshake failure

安稳与你 提交于 2020-01-14 09:07:48
问题 I have haproxy v1.5.4 working with http & https. I am binding *:80 & :*443 to the same frontend and using the same acls. I want to create an http -> https redirect frontend http-in bind *:80 bind *:443 ssl crt /etc/pki/tls/certs/... ... acl is_office path_beg /office http-request redirect scheme https if !{ ssl_fc } is_office use_backend office if is_office This causes 10.XXXXX:36909 [16/Dec/2015:17:23:07.678] http-in/2: SSL handshake failure when I access over http (expecting the redirect)

Haproxy ssl redirect handshake failure

筅森魡賤 提交于 2020-01-14 09:07:04
问题 I have haproxy v1.5.4 working with http & https. I am binding *:80 & :*443 to the same frontend and using the same acls. I want to create an http -> https redirect frontend http-in bind *:80 bind *:443 ssl crt /etc/pki/tls/certs/... ... acl is_office path_beg /office http-request redirect scheme https if !{ ssl_fc } is_office use_backend office if is_office This causes 10.XXXXX:36909 [16/Dec/2015:17:23:07.678] http-in/2: SSL handshake failure when I access over http (expecting the redirect)