????SaltStack???LVS?????ù???
???????????? ???????[ 2014/12/1 15:47:44 ] ??????????????????
??????дStates
/srv/salt/lvs/loadblance.sls
# config lvs
{% if 'lvs-loadblance' in pillar %}
{% for each_lvs in pillar['lvs-loadblance'] %}
# config lvs vip
{{each_lvs['name']}}-vip:
network.managed:
- name: {{each_lvs['vip-nic'] + ":" + each_lvs['name']}}
- enable: True
- type: eth
- proto: none
- ipaddr: {{each_lvs['vip']}}
- netmask: 255.255.255.255
{% set service_address = each_lvs['vip'] + ":" + each_lvs['port']|string() %}
{{each_lvs['name']}}-service:
lvs_service.present:
- protocol: {{each_lvs['protocol']}}
- service_address: {{service_address}}
- scheduler: {{each_lvs['scheduler']}}
{% for each_rs in each_lvs['realservers'] %}
{% set server_address = each_rs['ip'] + ":" + each_rs['port']|string() %}
{{each_rs['name']}}-server:
lvs_server.present:
- protocol: {{each_lvs['protocol']}}
- service_address: {{service_address}}
- server_address: {{server_address}}
- packet_forward_method: {{each_rs['packet_forward_method']}}
- weight: {{each_rs['weight']}}
{% endfor %}
{% endfor %}
{% endif %}
/srv/salt/lvs/realserver.sls
# ignore arp
net.ipv4.conf.all.arp_ignore:
sysctl.present:
- value: 1
net.ipv4.conf.lo.arp_ignore:
sysctl.present:
- value: 1
net.ipv4.conf.all.arp_announce:
sysctl.present:
- value: 2
net.ipv4.conf.lo.arp_announce:
sysctl.present:
- value: 2
# config lvs vip
{% if 'lvs-realserver' in pillar %}
{% for each_lvs in pillar['lvs-realserver'] %}
lvs-vip:
network.managed:
- name: {{"lo" + ":" + each_lvs['name']}}
- enable: True
- type: eth
- proto: none
- ipaddr: {{each_lvs['vip']}}
- netmask: 255.255.255.255
{% endfor %}
{% endif %}
/srv/salt/top.sls
base:
'lvs':
- lvs.loadblance
'web-0*':
- lvs.realserver
???????????
????????????? ????LVS??? ????????????????????????:
????salt 'lvs*' saltutil.sync_all
???????LVS????:
????salt '*' state.highstate
??????LVS?????:
????salt 'lvs' lvs.list
???????
???????SaltStack LVS??飬??????????LVS???????LVS??????????LVS?????ù???????????????RealServer?????????μ?RealServer?? ??????? /srv/pillar/lvs/loadblance.sls ???????????ü???.
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11