keepalived+LVS高可用部署

目录

一.两台设备(2.130和2.133)作为调度器,前主后备

1.部署keepalived

2.修改配置文件准备启动

3.配置keepalived的系统日志并启动

二.模拟调度器掉点和web服务进程丢失

1.调度器掉点

2.当类似于httpd这种网站服务掉点

三.以三种健康检查方式引入演示LVS+keepalived

1.TCP_CHECK

2.HTTP_GET|SSL_GET

3.MISC


 

一.两台设备(2.130和2.133)作为调度器,前主后备

1.部署keepalived

链接:百度网盘 请输入提取码百度网盘为您提供文件的网络备份、同步和分享服务。空间大、速度快、安全稳固,支持教育网加速,支持手机端。注册使用百度网盘即可享受免费存储空间https://pan.baidu.com/s/1T0JmFUrKHe0I4htpniGYeg 提取码:dp1j

如下是两台设备都要做的,所以设备hostname有所不同但不影响

[root@localhost ~ ]# tar xvf keepalived-2.2.8.tar.gz -C /usr/local/src/
[root@localhost ~ ]# yum install -y openssl-devel
[root@localhost ~ ]# cd /usr/local/src/keepalived-2.2.8/
[root@localhost keepalived-2.2.8]# yum install -y gcc gcc-c++ make openssl-devel
[root@localhost keepalived-2.2.8]# ./configure --prefix=/usr/local/keepalived \
> --sysconfdir=/etc --sbindir=/usr/sbin --bindir=/usr/bin 
#指定安装、系统配置目录等,有需要的可以自己修改
[root@localhost keepalived-2.2.8]# make && make install  #编译安装
[root@main keepalived-2.2.8]# tree /etc/keepalived/
/etc/keepalived/
├── keepalived.conf.sample
└── samples├── keepalived.conf.conditional_conf├── keepalived.conf.fwmark├── keepalived.conf.HTTP_GET.port├── keepalived.conf.inhibit├── keepalived.conf.IPv6├── keepalived.conf.misc_check├── keepalived.conf.misc_check_arg├── keepalived.conf.PING_CHECK├── keepalived.conf.quorum├── keepalived.conf.sample├── keepalived.conf.SMTP_CHECK├── keepalived.conf.SSL_GET├── keepalived.conf.status_code├── keepalived.conf.track_interface├── keepalived.conf.UDP_CHECK├── keepalived.conf.virtualhost├── keepalived.conf.virtual_server_group├── keepalived.conf.vrrp├── keepalived.conf.vrrp.localcheck├── keepalived.conf.vrrp.lvs_syncd├── keepalived.conf.vrrp.routes├── keepalived.conf.vrrp.rules├── keepalived.conf.vrrp.scripts├── keepalived.conf.vrrp.static_ipaddress├── keepalived.conf.vrrp.sync├── sample.misccheck.smbcheck.sh└── sample_notify_fifo.sh
​
1 directory, 28 files
[root@main keepalived-2.2.8]# tree /usr/local/keepalived/
/usr/local/keepalived/
└── share├── doc│   └── keepalived│       └── README├── man│   ├── man1│   │   └── genhash.1│   ├── man5│   │   └── keepalived.conf.5│   └── man8│       └── keepalived.8└── snmp└── mibs
​
9 directories, 4 files
[root@main keepalived-2.2.8]# cat /usr/lib/systemd/system/keepalived.service 
[Unit]
Description=LVS and VRRP High Availability Monitor
After=network-online.target syslog.target 
Wants=network-online.target 
Documentation=man:keepalived(8)
Documentation=man:keepalived.conf(5)
Documentation=man:genhash(1)
Documentation=https://keepalived.org
​
[Service]
Type=forking
PIDFile=/run/keepalived.pid
KillMode=process
EnvironmentFile=-/etc/sysconfig/keepalived
ExecStart=/usr/sbin/keepalived  $KEEPALIVED_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
​
[Install]
WantedBy=multi-user.target
[root@main keepalived-2.2.8]# vim /etc/sysconfig/keepalived 
[root@main keepalived-2.2.8]# tail -1 /etc/sysconfig/keepalived 
KEEPALIVED_OPTIONS="-D -d -S 0"
[root@main keepalived-2.2.8]# vim /etc/rsyslog.conf 
[root@main keepalived-2.2.8]# systemctl restart rsyslog.service 
#服务脚本,但是启动还无法正常完成,继续往下看

2.修改配置文件准备启动

(1)这是主设备

[root@main keepalived]# pwd
/etc/keepalived
[root@main keepalived]#  cp keepalived.conf.sample keepalived.conf #修改此文件,这里只放了修改了的部分
[root@main keepalived]# cat keepalived.conf
! Configuration File for keepalived
​
global_defs {#notification_email {#  acassen@firewall.loc#  failover@firewall.loc#  sysadmin@firewall.loc   #这些觉得暂时用不上可以先不管#}#notification_email_from Alexandre.Cassen@firewall.loc#smtp_server 192.168.2.130#smtp_connect_timeout 30router_id 1    #router_id,主备两个双设备需要不一致vrrp_skip_check_adv_addrvrrp_strictvrrp_garp_interval 0vrrp_gna_interval 0
}
​
vrrp_instance VI_1 {state MASTER   #设定类型为masterinterface ens33   #通信网卡名称virtual_router_id 1   #虚拟router组id,主备需要一致priority 100    #优先级值,主高于备advert_int 1authentication {auth_type PASS  #身份验证,密码也需要主备一致auth_pass 1111}virtual_ipaddress {192.168.2.100   #要设定的VIP,主备一致}
}

(2)备设备

[root@serverc keepalived]# cat keepalived.conf
! Configuration File for keepalived
​
global_defs {#notification_email {#  acassen@firewall.loc#  failover@firewall.loc#  sysadmin@firewall.loc#}#notification_email_from Alexandre.Cassen@firewall.loc#smtp_server 192.168.200.1#smtp_connect_timeout 30router_id 2   #主备不一致vrrp_skip_check_adv_addrvrrp_strictvrrp_garp_interval 0vrrp_gna_interval 0
}
​
vrrp_instance VI_1 {state BACKUP   #设定为BACKUPinterface ens33   #通信网卡名称virtual_router_id 1   #组id一致priority 80   #优先级要低于主advert_int 1nopreempt    #非抢占模式authentication {auth_type PASS   #主备一致auth_pass 1111}virtual_ipaddress {192.168.2.100   #VIP,主备一致}
}

3.配置keepalived的系统日志并启动

[root@main ~]# vim /etc/sysconfig/keepalived   #此文件是自动生成的,修改内容如下
KEEPALIVED_OPTIONS="-D -d -S 0"
[root@main ~]# vim /etc/rsyslog.conf
.# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log
​
# Save keepalived messages also to keepalived.log
local0.*                                                /var/log/keepalived.log
#找准位置添加local0这行
#将这几行取消注释
$ModLoad imudp
$UDPServerRun 514
$ModLoad imtcp
$InputTCPServerRun 514
[root@main ~]# systemctl restart rsyslog.service keepalived.service
[root@main ~]# tail -5 /var/log/keepalived.log   #日志已经产生内容
Mar 27 20:01:48 main Keepalived_vrrp[33409]: Sending gratuitous ARP on ens33 for 192.168.2.100
Mar 27 20:01:48 main Keepalived_vrrp[33409]: Sending gratuitous ARP on ens33 for 192.168.2.100
Mar 27 20:01:48 main Keepalived_vrrp[33409]: Sending gratuitous ARP on ens33 for 192.168.2.100
Mar 27 20:01:48 main Keepalived_vrrp[33409]: Sending gratuitous ARP on ens33 for 192.168.2.100
Mar 27 20:01:48 main Keepalived_vrrp[33409]: Sending gratuitous ARP on ens33 for 192.168.2.100
​
[root@main ~]# ip a| grep ens33 -A3   #并且主设备上的VIP已经生成
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:5d:7f:b7 brd ff:ff:ff:ff:ff:ffinet 192.168.2.130/24 brd 192.168.2.255 scope global noprefixroute ens33valid_lft forever preferred_lft foreverinet 192.168.2.100/32 scope global ens33valid_lft forever preferred_lft foreverinet6 fe80::bf1e:b2a3:a943:8a6d/64 scope link noprefixroute valid_lft forever preferred_lft forever

二.模拟调度器掉点和web服务进程丢失

1.调度器掉点

(1)VIP分配在主设备时,访问到hell

a5d15186f924425298c429f29dbb8f46.png

(2)主设备服务器断开、keepalived服务失效

此时VIP备绑定去备设备上了,访问到的内容也变为nihao

[root@main ~]# systemctl stop keepalived.service
[root@serverc keepalived]# ip a | grep ens33 -A1
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:2b:95:b3 brd ff:ff:ff:ff:ff:ffinet 192.168.2.133/24 brd 192.168.2.255 scope global noprefixroute ens33valid_lft forever preferred_lft foreverinet 192.168.2.100/32 scope global ens33valid_lft forever preferred_lft forever

34d7dcbe3f6944c8954263cc2d8d57d3.png

2.当类似于httpd这种网站服务掉点

使用脚本后台运行来保障httpd和keepalived持续运转

[root@main keepalived]# cat testhttpd.sh 
#!/bin/bash
while true; dohttpdpid=$(ps -C httpd --no-header | wc -l)if [ ${httpdpid} -eq 0 ]; thensystemctl start httpdsleep 10httpdpid=$(ps -C httpd --no-header | wc -l)if [ ${httpdpid} -eq 0 ]; thensystemctl stop keepalivedfielsesystemctl restart httpdfisleep 10
done
​
[root@main keepalived]# nohup ./testhttpd.sh &
[2] 49373
[root@main keepalived]# nohup: ignoring input and appending output to ‘nohup.out’
^C
[root@main keepalived]# jobs
[1]+  Stopped                 ֌  (wd: ~)
[2]-  Running                 nohup ./testhttpd.sh &
​
[root@main keepalived]# systemctl stop httpd  #手动停掉后过几秒又将其启动起来了
[root@main keepalived]# ps -C httpdPID TTY          TIME CMD
[root@main keepalived]# ps -C httpdPID TTY          TIME CMD51258 ?        00:00:00 httpd51259 ?        00:00:00 httpd51261 ?        00:00:00 httpd51262 ?        00:00:00 httpd51263 ?        00:00:00 httpd51264 ?        00:00:00 httpd51288 ?        00:00:00 httpd

三.以三种健康检查方式引入演示LVS+keepalived

主设备-192.168.2.130

备设备-192.168.2.133

VIP-192.168.2.100

RS1-192.168.2.131

RS2-192.168.2.132

1.TCP_CHECK

(1)主设备配置

[root@main keepalived]# cat keepalived.conf
! Configuration File for keepalived
​
global_defs {#notification_email {#  acassen@firewall.loc#  failover@firewall.loc#  sysadmin@firewall.loc#}#notification_email_from Alexandre.Cassen@firewall.loc#smtp_server 192.168.2.130#smtp_connect_timeout 30router_id 1vrrp_skip_check_adv_addrvrrp_strictvrrp_garp_interval 0vrrp_gna_interval 0
}
​
vrrp_instance VI_1 {state MASTERinterface ens33virtual_router_id 1mcast_src_ip 192.168.2.130priority 100advert_int 1nopreemptauthentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.2.100}
}
​
virtual_server 192.168.2.100 80 {         #VIPdelay_loop 6   #健康检查间隔时间lb_algo rr   #调度方式为rrlb_kind DR   #LVS模式为DRprotocol TCP   #TCP协议
​real_server 192.168.2.131 80 {   #RIP1weight 1    #权重值TCP_CHECK {     #TCP_CHECK方式connect_timeout 3  #连接超时时间nb_get_retry 3   #重连次数connection_port 80   #检查端口delay_before_retry 3   #重连间隔时间}}real_server 192.168.2.132 80 {   #RIP2weight 1TCP_CHECK {connect_timeout 3nb_get_retry 3connection_port 80delay_before_retry 3}}
}
[root@main keepalived]# systemctl restart keepalived.service

(2)备设备配置

[root@serverc keepalived]# cat keepalived.conf
! Configuration File for keepalived
​
global_defs {#notification_email {#  acassen@firewall.loc#  failover@firewall.loc#  sysadmin@firewall.loc#}#notification_email_from Alexandre.Cassen@firewall.loc#smtp_server 192.168.200.1#smtp_connect_timeout 30router_id 2vrrp_skip_check_adv_addrvrrp_strictvrrp_garp_interval 0vrrp_gna_interval 0
}
​
vrrp_instance VI_1 {state BACKUPinterface ens33virtual_router_id 1priority 80advert_int 1nopreemptauthentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.2.100}
}
​
virtual_server 192.168.2.100 80 {delay_loop 6lb_algo rrlb_kind DRprotocol TCP
​real_server 192.168.2.131 80 {weight 1TCP_CHECK {connect_timeout 3nb_get_retry 3connection_port 80delay_before_retry 3}}real_server 192.168.2.132 80 {weight 1TCP_CHECK {connect_timeout 3nb_get_retry 3connection_port 80delay_before_retry 3}}
}
[root@serverc keepalived]# systemctl restart keepalived.service

(3)节点执行lvs-dr脚本服务,来进行绑定VIP和添加通信路由,这步可以手动做,参考前面lvs-dr集群的文章

[root@servera ~]# vim /etc/init.d/lvs-dr
[root@servera ~]# cat /etc/init.d/lvs-dr   #VIP等需要自己更改
#!/bin/bash
LOCK=/var/lock/ipvsadm.lock
VIP=192.168.2.100
. /etc/rc.d/init.d/functions
start() {PID=`ifconfig | grep lo:130 | wc -l`if [ $PID -ne 0 ];thenecho "The LVS-DR-RIP Server is already running !"else/sbin/ifconfig lo:130 $VIP netmask 255.255.255.255 broadcast $VIP up/sbin/route add -host $VIP dev lo:130echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignoreecho "2" >/proc/sys/net/ipv4/conf/lo/arp_announceecho "1" >/proc/sys/net/ipv4/conf/ens33/arp_ignoreecho "2" >/proc/sys/net/ipv4/conf/ens33/arp_announceecho "1" >/proc/sys/net/ipv4/conf/all/arp_ignoreecho "2" >/proc/sys/net/ipv4/conf/all/arp_announce/bin/touch $LOCKecho "starting LVS-DR-RIP server is ok !"fi
}
stop() {/sbin/route del -host $VIP dev lo:130/sbin/ifconfig lo:130 down >/dev/nullecho "0" >/proc/sys/net/ipv4/conf/lo/arp_ignoreecho "0" >/proc/sys/net/ipv4/conf/lo/arp_announceecho "0" >/proc/sys/net/ipv4/conf/ens33/arp_ignoreecho "0" >/proc/sys/net/ipv4/conf/ens33/arp_announceecho "0" >/proc/sys/net/ipv4/conf/all/arp_ignoreecho "0" >/proc/sys/net/ipv4/conf/all/arp_announcerm -rf $LOCKecho "stopping LVS-DR-RIP server is ok !"
}
status() {if [ -e $LOCK ];thenecho "The LVS-DR-RIP Server is already running !"elseecho "The LVS-DR-RIP Server is not running !"fi
}
case "$1" instart)start;;stop)stop;;restart)stopstart;;status)status;;*)echo "Usage: $1 {start|stop|restart|status}"exit 1
esac
exit 0
​
[root@servera ~]# systemctl daemon-reload
[root@servera ~]# service lvs-dr start
[root@servera ~]# route -n   #通信路由添加成功
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    100    0        0 ens33
192.168.2.0     0.0.0.0         255.255.255.0   U     100    0        0 ens33
192.168.2.100   0.0.0.0         255.255.255.255 UH    0      0        0 lo
[root@servera ~]# ip a| grep lo   #环回创建成功
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host loinet 192.168.2.100/32 brd 192.168.2.100 scope global lo:130inet 192.168.2.131/24 brd 192.168.2.255 scope global noprefixroute ens33

(4)主设备上查看VIP是否创建成功

[root@main keepalived]# ip a | grep ens33 -A1
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:5d:7f:b7 brd ff:ff:ff:ff:ff:ffinet 192.168.2.130/24 brd 192.168.2.255 scope global noprefixroute ens33valid_lft forever preferred_lft foreverinet 192.168.2.100/32 scope global ens33valid_lft forever preferred_lft forever
[root@main keepalived]# ipvsadm -Ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags-> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  192.168.2.100:80 rr-> 192.168.2.131:80             Route   1      0          0         -> 192.168.2.132:80             Route   1      0          0      

(5)进行测试

负载均衡测试

[root@localhost ~]# for ((i=1;i<=10;i++));do curl 192.168.2.100;done
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11

节点131上httpd服务掉点,具体可以通过watch ipvsadm -Ln来查看节点剔除和恢复过程

[root@localhost ~]# for ((i=1;i<=10;i++));do curl 192.168.2.100;done
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12

主调度器设备130掉点

[root@main keepalived]# systemctl stop keepalived.service
[root@serverc keepalived]# ip a | grep ens33 -A1
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:2b:95:b3 brd ff:ff:ff:ff:ff:ffinet 192.168.2.133/24 brd 192.168.2.255 scope global noprefixroute ens33valid_lft forever preferred_lft foreverinet 192.168.2.100/32 scope global ens33valid_lft forever preferred_lft forever
[root@localhost ~]# for ((i=1;i<=10;i++));do curl 192.168.2.100;done
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
#负载均衡正常

2.HTTP_GET|SSL_GET

以genhash来生成检查摘要信息

[root@main keepalived]# genhash -s 192.168.2.131 -p 80 -u /index.html
db1dd528b0e0c9a347eda778aec00559
[root@main keepalived]# genhash -s 192.168.2.132 -p 80 -u /index.html
27d4c8a485f28559e9b1737702b40225
​
#如下配置
virtual_server 192.168.2.100 80 {delay_loop 6lb_algo rrlb_kind DRprotocol TCP
​real_server 192.168.2.131 80 {weight 1
#        TCP_CHECK {
#            connect_timeout 3
#            nb_get_retry 3
#            connection_port 80
#            delay_before_retry 3
#        }HTTP_GET {url {path /index.htmldigset 2d4074c5771f087dd468d1960185f1f5}connect_port 80connect_timeout 3nb_get_retry 3delay_before_retry 3}   }real_server 192.168.2.132 80 {weight 1
#        TCP_CHECK {
#            connect_timeout 3
#            nb_get_retry 3
#            connection_port 80
#            delay_before_retry 3
#        }HTTP_GET {url {path /index.htmldigset 2d4074c5771f087dd468d1960185f1f5  #基于页面后端hash值#status 200   #基于返回状态码}   connect_port 80connect_timeout 3nb_get_retry 3delay_before_retry 3}}
}
#重启keepalived后测试

测试

[root@localhost ~]# for ((i=1;i<=10;i++));do curl 192.168.2.100;done   #负载均衡
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
[root@localhost ~]# for ((i=1;i<=10;i++));do curl 192.168.2.100;done  #节点1掉点
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
10.0.0.12
​
​
[root@main keepalived]# systemctl stop keepalived.service   #主设备掉点,负载均衡正常
[root@serverc keepalived]# ip a |grep ens33 -A1
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:2b:95:b3 brd ff:ff:ff:ff:ff:ffinet 192.168.2.133/24 brd 192.168.2.255 scope global noprefixroute ens33valid_lft forever preferred_lft foreverinet 192.168.2.100/32 scope global ens33valid_lft forever preferred_lft forever
[root@localhost ~]# for ((i=1;i<=10;i++));do curl 192.168.2.100;done
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12
10.0.0.11
10.0.0.12

3.MISC

利用健康测试脚本来测试httpd服务

real_server 192.168.2.131 80 {weight 1MISC_CHECK {misc_path "/etc/keepalived/test.sh 192.168.2.131"misc_timeout 3
​}
#        TCP_CHECK {
#            connect_timeout 3
#            nb_get_retry 3
#            connection_port 80
#            delay_before_retry 3
#        }
#        HTTP_GET {
#           url {
#                path /index.html
#                digset 2d4074c5771f087dd468d1960185f1f5
#               status 200
#            }
#            connect_port 80
#           connect_timeout 3
#           nb_get_retry 3
#            delay_before_retry 3
#        }}
[root@main keepalived]# cat test.sh    #只针对200状态码
#!/bin/bash
if [ $# -ne 1 ]
thenecho "You should supply an url parameter."exit 1
elsen=`curl -I "$1" 2> /dev/null | grep "200 OK" | wc -l`if [ $n -eq 1 ]thenexit 0elseexit 1fi
fi
​
[root@main keepalived]# cat test.sh   #可以使用nmap来做,yum install -y nmap
#!/bin/bash
if [ $# -ne 1 ]
thenecho "You should supply an url parameter."exit 1
elseip_and_path=$1ip=$(echo "$ip_and_path" | sed 's/.*\/\/\([0-9.]*\).*/\1/')n=$(nmap -p80 "$ip" | awk '/^80\/tcp/ {print $2}')if [ $n == 'open' ]thenexit 0elseexit 1fi
fi

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/791106.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C++ 前K个高频单词的六种解法

目录 大堆 小堆 vectorsort vectorstable_sort multimap set/multiset 与GPT的对话 1.对于比较类型中 < 运算符重载的理解 2.map有稳定性的说法吗 ​编辑 3.为什么map和set类的仿函数后面要加const来修饰*this 5.关于名词的理解 6.匿名对象对类要求 7.map和set的…

新手使用GIT上传本地项目到Github(个人笔记)

亲测下面的文章很有用处。 1. 初次使用git上传代码到github远程仓库 - 知乎 (zhihu.com) 2. 使用Git时出现refusing to merge unrelated histories的解决办法 - 知乎

【大数据存储】实验五:Mapreduce

实验Mapreduce实例——排序&#xff08;补充程序&#xff09; 实验环境 Linux Ubuntu 16.04 jdk-8u191-linux-x64 hadoop-3.0.0 hadoop-eclipse-plugin-2.7.3.jar eclipse-java-juno-SR2-linux-gtk-x86_64 实验内容 在电商网站上&#xff0c;当我们进入某电商页面里浏览…

windows@软件显示模糊@屏幕显示器分辨率和精细度

文章目录 refsDPIPPIPPI (Pixels Per Inch)DPI (Dots Per Inch) 屏幕尺寸数windows中DPI设置对单个应用设置DPI兼容性设置使用系统全局设置 获取屏幕(监视器)信息&#x1f47a;获取监视器的型号pnp 监视器windows 获取屏幕分辨率 高分辨率屏幕高分辨率和高精细度屏幕&#x1f4…

RedHat9中KVM虚拟机的配置与管理

KVM虚拟技术介绍 Linux的KVM&#xff08;Kernel-based Virtual Machine&#xff09;虚拟技术是一种基于Linux内核的虚拟化解决方案。它允许在单个物理服务器上创建和运行多个隔离的虚拟机&#xff0c;每个虚拟机都有自己的操作系统和应用程序&#xff0c;就像运行在独立的物理…

MyBatis入门到掌握(JAVA)

建立连接可能涉及到的问题&#xff08;只需要自己改一下就行&#xff09; 1、MyBatis是⼀款优秀的 持久层 框架&#xff0c;⽤于简化JDBC的开发 2、数据库连接配置 &#xff08;1&#xff09;yml配置 # 数据库连接配置 spring:datasource:url: jdbc:mysql://127.0.0.1:3306/…

OAuth2-03-springboot 整合

拓展阅读 OAuth 2.0-01-Overview OAuth2-02-java 整合 OAuth2-03-springboot 整合 序言 安全性是暴露由许多微服务组成的公共访问API时要考虑的最重要的一个方面。 Spring有一些有趣的功能和框架&#xff0c;使我们的微服务安全配置更容易。 在本文中&#xff0c;我将向…

基于SpringBoot的“致远汽车租赁系统”的设计与实现(源码+数据库+文档+PPT)

基于SpringBoot的“致远汽车租赁系统”的设计与实现&#xff08;源码数据库文档PPT) 开发语言&#xff1a;Java 数据库&#xff1a;MySQL 技术&#xff1a;SpringBoot 工具&#xff1a;IDEA/Ecilpse、Navicat、Maven 系统展示 致远汽车租赁系统总体功能模块图 系统首页界…

2024年 前端JavaScript 进阶 第3天 笔记

3.1-JS进阶-内容和两种编程思想 3.2-构造函数实现封装以及存在 3.3-原型对象prototype 3.4-数组扩展案例-求最大值和数组求和 3.5-constructor属性以及应用 3.6-对象原型proto 3.7-原型继承 3.8-原型链以及instanceof运算符 3.9-综合案例-模态框构造函数写法 3.10-综合案例-0pe…

Phpstorm配置Xdebug

步骤 1、先去官网找到对应的php xdebug的版本 2、配置phpstorm断点调试 网址&#xff1a;https://xdebug.org/ 查看php对应的xdebug版本&#xff1a;Xdebug: Support — Tailored Installation Instructions 1.1查看对应php xdebug版本 全选&#xff0c;复制到目标网址 我…

笔记本三屏异显方案——更新中,是否能够在FPGA上实现,淘宝购物的价格太贵

三屏是&#xff08;笔记本电脑屏幕&#xff0c;两个显示器屏幕&#xff09;&#xff0c;异显是采用屏幕的扩展功能&#xff0c;这样能够左边看视频文章&#xff0c;右边control cv代码。 一、 电脑有一个HDMI口的时候&#xff0c;只需要买一个TypeC&#xff08;雷电接口&#x…

FreeBSD下如何进行添加路由等配置?

FreeBSD系统可以当作一台路由器来使用&#xff0c;实际上当年路由器刚刚出来的时候&#xff0c;有很大一部分就是用主机安装FreeBSD来提供路由功能的。 路由的基础知识 路由&#xff0c;就是计算机网络中决定数据包从源地址到目的地址路径的一种传输过程。路由表&#xff0c;就…

【前端Vue】社交信息头条项目完整笔记第3篇:三、个人中心,TabBar 处理【附代码文档】

社交媒体-信息头条项目完整开发笔记完整教程&#xff08;附代码资料&#xff09;主要内容讲述&#xff1a;一、项目初始化使用 Vue CLI 创建项目,加入 Git 版本管理,调整初始目录结构,导入图标素材,引入 Vant 组件库,移动端 REM 适配。二、登录注册准备,实现基本登录功能,登录状…

vue 数据埋点

最近菜鸟做项目&#xff0c;需要做简单的数据埋点&#xff0c;不是企业级的&#xff0c;反正看渡一的视频&#xff0c;企业级特别复杂&#xff0c;包括但不限于&#xff1a;错误收集、点击地方、用户行为…… 菜鸟的需求就是简单收集一下用户的ip、地址、每个界面的访问时间&a…

技术揭秘:如何打造完美互动的充电桩硬件与服务平台?

充电桩平台全套源码地址 https://gitee.com/chouleng/cdzkjjh.git 这张图像是一个系统或服务的架构图。以下是对图中各个部分的描述&#xff1a; 前端&#xff1a; 位于图像的顶部&#xff0c;颜色为浅绿色。用户服务端&#xff1a; 紧邻前端&#xff0c;颜色为淡黄色。设备服…

MOS管小电流发热怎么处理?

01 MOSFET的击穿有哪几种&#xff1f; Source、Drain、Gate —— 场效应管的三极&#xff1a;源级S、漏级D、栅级G。&#xff08;这里不讲栅极GOX击穿了啊&#xff0c;只针对漏极电压击穿&#xff09; 先讲测试条件&#xff0c;都是源栅衬底都是接地&#xff0c;然后扫描漏极…

【局部路径规划算法】—— DWA动态窗口法(c++实现))

参考资料&#xff1a; &#xff08;1&#xff09;机器人局部避障的动态窗口法(dynamic window approach) &#xff08;2&#xff09;机器人局部避障的动态窗口法 &#xff08;3&#xff09;局部规划算法&#xff1a;DWA算法原理 &#xff08;4&#xff09;SLAM学习&#xff1a;…

安卓开机动画

目录 一、开机动画的2种模式1.1 android模式2.2 movie模式 二、开机动画代码运行位置三、删除开机动画四、自定义开机动画实践 一、开机动画的2种模式 一种是使用两张图片利用某种效果来造成动态&#xff0c;另一种则是用一个图包循环显示的方式来形成动态。当然&#xff0c;这…

软考高级架构师:CISC (复杂指令集计算机) 和 RISC (精简指令集计算机)概念和例题

作者&#xff1a;明明如月学长&#xff0c; CSDN 博客专家&#xff0c;大厂高级 Java 工程师&#xff0c;《性能优化方法论》作者、《解锁大厂思维&#xff1a;剖析《阿里巴巴Java开发手册》》、《再学经典&#xff1a;《Effective Java》独家解析》专栏作者。 热门文章推荐&am…

去班味的尽头是风险管理

运维工程师的“班味”是从风险管理就加重的。 什么是班味呢&#xff1f;指的是打工人身上特有的疲惫气质&#xff0c;面色憔悴、双目无神和腰酸背痛都是“班味”的显著表现。习惯性回复“收到&#xff0c;马上来”、不自觉唉声叹气、下班也提不起精神等症状&#xff0c;则说明…