NetScaler CPX部署、配置与使用
About NetScaler CPX
May 13, 2016
Citrix NetScaler CPX is a container-based application delivery controller that can be provisioned on a Docker host. NetScaler CPX enables customers to leverage Docker engine capabilities and use NetScaler load balancing and traffic management features for container-based applications. You can deploy one or more NetScaler CPX instances as standalone instances on a Docker host.
A NetScaler CPX instance provides throughput of up to 1 Gbps.
部署
安装docker
https://docs.docker.com/engine/installation/linux/centos/使用cpx的容器镜像生成cpx
从以下地址获取cpx的容器镜像cpx-11.1-48.10.gz1
https://www.microloadbalancer.com/get-it-now
执行以下操作
1
2
3
4
5
6
7
8
9
10
11
12
13[root@netscaler ~]# docker load -i cpx-11.1-48.10.gz
[root@netscaler ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
cpx 11.1-48.10 9c5a5e94c333 5 months ago 605.4 MB
[root@netscaler ~]# docker run -dt -p 22 -p 80 -p 161/udp --ulimit core=-1 --privileged=true 9c5a5e94c333
786ccae5253fe35023ea18c10ade1b66780e28c558bee849fec700c18dd9dd58
[root@netscaler ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
786ccae5253f 9c5a5e94c333 "/bin/sh -c 'bash -C " 6 seconds ago Up 3 seconds 443/tcp, 0.0.0.0:32769->22/tcp, 0.0.0.0:32768->80/tcp, 0.0.0.0:32768->161/udp kickass_euclid根据所给出的ssh端口登录cpx,默认登录口令为root/linux。
配置
进入cpx后,执行命令需要加载cpx的client脚本,cli_script.sh,即:
1 | # cli_script.sh "show ns feature" |
开启ns的lb特性
1 | root@786ccae5253f:~# cli_script.sh "enable ns feature LoadBalancing" |
创建一个service
1 | add service <name> <serverName> <serviceType> <port> |
serverName表示地址
serviceType有HTTP、SSL、FTP、TCP、SSL_TCP、UDP、SSL_BRIDGE、NNTP、DNS、ANY、SIP-UDP、DNS-TCP、RTSP、DHCPRA、DIAMETER、SSL_DIAMETER
示例:
1 | add service Service-HTTP-1 192.0.2.5 HTTP 80 |
创建一个virtual server
1 | add lb vserver <name> <serviceType> <ip> <port> |
示例:
1 | add lb vserver Vserver-LB-1 HTTP 10.102.29.60 80 |
绑定virtual server与services
1 | bind lb vserver <name> <serviceName> |
示例:
1 | bind lb vserver Vserver-LB-1 Service-HTTP-1 |
除了client,cpx还提供了可用于配置、使用的api,访问地址为:http://
举个栗子
本栗中,NetScaler CPX与Openstack结合,虽然并没有对应的cpx的driver,仅尝试与虚拟机手动绑定,使用cpx作两个虚拟机的ssh负载均衡器:
使用openstack创建两个虚拟机,ip地址分别为30.0.0.8、30.0.0.9
为这两个虚拟机绑定浮动ip
1
230.0.0.8 - 172.14.0.4
30.0.0.9 - 172.14.0.5在cpx中创建两个services
1
2add service SERVER_A 172.14.0.4 TCP 22
add service SERVER_B 172.14.0.5 TCP 22创建一个ssh的lb
1
add lb vserver LB_SSH TCP 172.14.0.10 22
绑定这个lb与两个虚拟机
1
2bind lb vserver LB_SSH SERVER_A
bind lb vserver LB_SSH SERVER_B