keepalived

文章目录

      • 一、suse系统安装keepalived
        • 1.1、准备环境
        • 1.2、修改主机名
        • 1.3、关闭防火墙
        • 1.4、配置网络
        • 1.5、配置 yum 源
        • 1.6、安装 mysql
        • 1.7、安装 keepalived
        • 报错信息:
          • 使用 wget 下载keepalived 报错
          • 解决 使用 wget 下载 keepalived的报错

一、suse系统安装keepalived

1.1、准备环境

操作系统IP应用软件VIP
SUSE192.168.192.150mysql
keepalived
192.168.192.100

1.2、修改主机名

linux-40pb:~ # hostnamectl set-hostname suse  # 修改主机名为:suse
linux-40pb:~ # 
linux-40pb:~ # bash
suse:~ # 
suse:~ # cat /etc/os-release   # 查看系统版本信息
NAME="SLES"
VERSION="12-SP5"
VERSION_ID="12.5"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP5"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12:sp5"
suse:~ # 
suse:~ # uname -m  # 输出主机的硬件架构名称
x86_64
suse:~ # 

1.3、关闭防火墙

suse:~ # systemctl status SuSEfirewall2  # 查看防火墙状态
● SuSEfirewall2.service - SuSEfirewall2 phase 2Loaded: loaded (/usr/lib/systemd/system/SuSEfirewall2.service; enabled; vendor preset: disabled)Active: active (exited) since Sat 2023-07-08 08:28:07 CST; 3s agoProcess: 2374 ExecStart=/usr/sbin/SuSEfirewall2 boot_setup (code=exited, status=0/SUCCESS)Main PID: 2374 (code=exited, status=0/SUCCESS)Jul 08 08:28:06 suse systemd[1]: Starting SuSEfirewall2 phase 2...
Jul 08 08:28:06 suse SuSEfirewall2[2374]: Setting up rules from /etc/sysconfig/SuSEfirewall2 ...
Jul 08 08:28:06 suse SuSEfirewall2[2374]: using default zone 'ext' for interface eth0
Jul 08 08:28:07 suse SuSEfirewall2[2374]: Firewall rules successfully set
Jul 08 08:28:07 suse systemd[1]: Started SuSEfirewall2 phase 2.
suse:~ # suse:~ # systemctl disable --now SuSEfirewall2  # 关闭防火墙,并关闭开机自启功能
Removed symlink /etc/systemd/system/multi-user.target.wants/SuSEfirewall2.service.
Removed symlink /etc/systemd/system/multi-user.target.wants/SuSEfirewall2_init.service.
Removed symlink /etc/systemd/system/SuSEfirewall2_setup.service.
Failed to stop SuSEfirewall2_setup.service: Unit SuSEfirewall2_setup.service not loaded.
suse:~ # 
suse:~ # systemctl status SuSEfirewall2 #  查看防火墙状态
● SuSEfirewall2.service - SuSEfirewall2 phase 2Loaded: loaded (/usr/lib/systemd/system/SuSEfirewall2.service; disabled; vendor preset: disabled)Active: inactive (dead)Jul 08 08:28:06 suse systemd[1]: Starting SuSEfirewall2 phase 2...
Jul 08 08:28:06 suse SuSEfirewall2[2374]: Setting up rules from /etc/sysconfig/SuSEfirewall2 ...
Jul 08 08:28:06 suse SuSEfirewall2[2374]: using default zone 'ext' for interface eth0
Jul 08 08:28:07 suse SuSEfirewall2[2374]: Firewall rules successfully set
Jul 08 08:28:07 suse systemd[1]: Started SuSEfirewall2 phase 2.
Jul 08 08:29:04 suse systemd[1]: Stopping SuSEfirewall2 phase 2...
Jul 08 08:29:04 suse systemd[1]: Stopped SuSEfirewall2 phase 2.
suse:~ # 

1.4、配置网络

suse:~ # ip a
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 lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:70:2e:ec brd ff:ff:ff:ff:ff:ffinet 192.168.192.150/24 brd 192.168.192.255 scope global eth0valid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fe70:2eec/64 scope link valid_lft forever preferred_lft forever
suse:~ # 
suse:~ # cd /etc/sysconfig/network/
suse:/etc/sysconfig/network # ll
total 68
-rw-r--r-- 1 root root  9692 Apr 17 02:24 config
-rw-r--r-- 1 root root 14432 Apr 17 02:24 dhcp
drwxr-xr-x 1 root root    40 Apr 17 02:23 if-down.d
drwxr-xr-x 1 root root    66 Apr 17 02:23 if-up.d
-rw-r--r-- 1 root root   149 Jul  8 09:38 ifcfg-eth0
-rw------- 1 root root   147 Apr 17 02:24 ifcfg-lo
-rw-r--r-- 1 root root 21738 Oct 14  2016 ifcfg.template
drwx------ 1 root root     0 Jun 27  2017 providers
-rw-r--r-- 1 root root    29 Jul  8 09:35 routes
drwxr-xr-x 1 root root   206 Apr 17 02:23 scripts
suse:/etc/sysconfig/network # 
suse:/etc/sysconfig/network # cp ifcfg-eth0 ifcfg-eth0_bak # 备份
suse:/etc/sysconfig/network # vi ifcfg-eth0
BOOTPROTO='static'  # 静态IP
BROADCAST='192.168.192.255'  # 广播地址
IPADDR='192.168.192.150'  # IP地址
NAME='eth0'   # 网卡名
NETMASK='255.255.255.0'   #  子网掩码
NETWORK='192.168.192.0'  # 网络地址
STARTMODE='auto'  #  开机启动网络
suse:/etc/sysconfig/network #
suse:/etc/sysconfig/network # cp routes routes_bak # 备份
suse:/etc/sysconfig/network # vi  routes # 配置网关
default 192.168.192.2 - eth0 
suse:/etc/sysconfig/network # 
suse:~ # tail -5 /etc/resolv.conf
# file and in case of a "netconfig update -f" call.
#
### Please remove (at least) this line when you modify the file!
nameserver 8.8.8.8  # 配置 DNS
nameserver 8.8.4.4  # 配置 DNS
suse:~ # 
suse:~ # ping www.baidu.com -w 3  # 测试能否 ping 通外网
PING www.a.shifen.com (180.101.50.242) 56(84) bytes of data.
64 bytes from 180.101.50.242: icmp_seq=1 ttl=128 time=15.7 ms
64 bytes from 180.101.50.242: icmp_seq=2 ttl=128 time=15.6 ms
64 bytes from 180.101.50.242: icmp_seq=3 ttl=128 time=15.9 ms--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 15.683/15.780/15.936/0.182 ms
suse:~ # 
# 如果 ping 不通外网排查一下网关问题

1.5、配置 yum 源

suse:~ # cd /etc/zypp/repos.d/
suse:/etc/zypp/repos.d # 
suse:/etc/zypp/repos.d # ls
SLES12-SP5-12.5-0.repo
suse:/etc/zypp/repos.d # mv SLES12-SP5-12.5-0.repo{,_bak}
suse:/etc/zypp/repos.d # 
suse:/etc/zypp/repos.d # ls
SLES12-SP5-12.5-0.repo_bak
suse:/etc/zypp/repos.d # vim xxx.repo # 添加一下内容
[suse]
name=suse
baseurl=file:///mnt
gpgcheck=0
enabled=1
suse:/etc/zypp/repos.d # 
suse:/etc/zypp/repos.d # mount /dev/cdrom /mnt/  # 挂载磁盘
mount: /mnt: WARNING: device write-protected, mounted read-only.
suse:/etc/zypp/repos.d # 
suse:/etc/zypp/repos.d # df -h | grep /mnt
/dev/sr0        3.9G  3.9G     0 100% /mnt
suse:/etc/zypp/repos.d # 
suse:~ # zypper lr  # 列出本地源
Repository priorities are without effect. All enabled repositories share the same priority.# | Alias | Name | Enabled | GPG Check | Refresh
--+-------+------+---------+-----------+--------
1 | suse  | suse | Yes     | (  ) No   | No     
suse:~ # # 测试是否已配置好 yum 源,下载 wget 命令是否能下载下来。
suse:~ # rpm -qa | grep wget
suse:~ # 
suse:~ # rpm -qa | grep wget  # 查看是否已安装 wget
suse:~ # 
suse:~ # zypper se wget  # 搜索软件包名为:wget
Loading repository data...
Reading installed packages...S | Name | Summary                                   | Type      
--+------+-------------------------------------------+-----------| wget | A Tool for Mirroring FTP and HTTP Servers | package   | wget | A Tool for Mirroring FTP and HTTP Servers | srcpackage
suse:~ # 
suse:~ # zypper in wget  # 安装 wget 命令
Loading repository data...
Reading installed packages...
Resolving package dependencies...The following NEW package is going to be installed:wget1 new package to install.
Overall download size: 494.3 KiB. Already cached: 0 B. After the operation, additional 2.0 MiB will be used.
Continue? [y/n/...? shows all options] (y): y  # 输入 y
Retrieving package wget-1.14-21.10.1.x86_64                                                                     (1/1), 494.3 KiB (  2.0 MiB unpacked)
Checking for file conflicts: ..................................................................................................................[done]
(1/1) Installing: wget-1.14-21.10.1.x86_64 ....................................................................................................[done]
suse:~ # 
suse:~ # rpm -qa | grep wget  # 查看是否已安装 wget
wget-1.14-21.10.1.x86_64
suse:~ # 

1.6、安装 mysql

suse:~ # cd /opt/
suse:/opt # ls
mysql-community-common-8.0.25-1.el7.x86_64.rpm
mysql-community-devel-8.0.25-1.el7.x86_64.rpm
mysql-community-client-8.0.25-1.el7.x86_64.rpm
mysql-community-libs-8.0.25-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm
mysql-community-server-8.0.25-1.el7.x86_64.rpm
suse:/opt # 
suse:/opt # rpm -ivh mysql-community-common-8.0.25-1.el7.x86_64.rpm
warning: mysql-community-common-8.0.25-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-common-8.0.25-1.e################################# [100%]
suse:/opt # suse:/opt # rpm -ivh mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm 
warning: mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-client-plugins-8.################################# [100%]
suse:/opt # rpm -ivh mysql-community-libs-8.0.25-1.el7.x86_64.rpm 
warning: mysql-community-libs-8.0.25-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-libs-8.0.25-1.el7################################# [100%]
suse:/opt # rpm -ivh mysql-community-client-8.0.25-1.el7.x86_64.rpm 
warning: mysql-community-client-8.0.25-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-client-8.0.25-1.e################################# [100%]suse:/opt # rpm -ivh mysql-community-devel-8.0.25-1.el7.x86_64.rpm
warning: mysql-community-devel-8.0.25-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-devel-8.0.25-1.el################################# [100%]suse:/opt # rpm -ivh mysql-community-server-8.0.25-1.el7.x86_64.rpm 
warning: mysql-community-server-8.0.25-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-server-8.0.25-1.e################################# [100%]
suse:/opt # suse:/opt # systemctl status mysqld  // 查看状态
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: inactive (dead)Docs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.html
suse:/opt #suse:/opt # systemctl start mysqld   // 启动MySQL
suse:/opt # systemctl status mysqld  // 查看状态
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Fri 2023-07-08 11:09:12 CST; 12s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 2949 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 3019 (mysqld)Status: "Server is operational"Tasks: 38 (limit: 512)CGroup: /system.slice/mysqld.service└─3019 /usr/sbin/mysqld
suse:/opt # 

1.7、安装 keepalived

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-L3grcJHG-1688786851016)(C:/Users/agan9/AppData/Roaming/Typora/typora-user-images/1688784841868.png)]

# 这里我使用wget 命令下载软件包。或者你下载好之后可以使用xftp传到主机里
suse:/opt # wget https://keepalived.org/software/keepalived-2.2.4.tar.gz
...省略下载过程Nsuse:/opt # ll
total 1176
-rw-r--r-- 1 root root 1202602 May 31 18:37 keepalived-2.2.4.tar.gz
suse:/opt # # 下载依赖包
suse:~ # zypper in  gcc gcc-c++ make openssl  kernel-devel
Loading repository data...
Reading installed packages...
'openssl' is already installed.
No update candidate for 'openssl-1.0.2p-1.13.noarch'. The highest available version is already installed.
'make' is already installed.
No update candidate for 'make-4.0-4.1.x86_64'. The highest available version is already installed.The following 19 NEW packages are going to be installed:gcc gcc-c++ gcc48 gcc48-c++ glibc-devel kernel-default-devel kernel-devel kernel-macros libasan0 libatomic1 libelf-devel libgomp1 libitm1libopenssl-1_0_0-devel libopenssl-devel libstdc++48-devel libtsan0 linux-glibc-devel zlib-devel19 new packages to install.
Overall download size: 50.8 MiB. Already cached: 0 B. After the operation, additional 147.0 MiB will be used.
Continue? [y/n/...? shows all options] (y): y  # 输入 y
···省略下载过程suse:~ # cd /opt/
suse:/opt # ll
total 1176
-rw-r--r-- 1 root root 1202602 May 31 18:37 keepalived-2.2.4.tar.gz
suse:/opt # tar xf keepalived-2.2.4.tar.gz  # 解压软件包
suse:/opt # ll
total 1176
drwxrwxr-x 1 1000 1000     412 May 31 18:35 keepalived-2.2.4
-rw-r--r-- 1 root root 1202602 May 31 18:37 keepalived-2.2.4.tar.gz
suse:/opt # 
suse:/opt # cd keepalived-2.2.4/
suse:/opt/keepalived-2.2.4 # 
suse:/opt/keepalived-2.2.4 # ls
AUTHOR        COPYING    Dockerfile.in  Makefile.am  README.md  aclocal.m4  bin_install  build_setup  configure.ac  keepalived          lib  snap
CONTRIBUTORS  ChangeLog  INSTALL        Makefile.in  TODO       autogen.sh  build-aux    configure    doc           keepalived.spec.in  m4   tools
suse:/opt/keepalived-2.2.4 # ./configure --prefix=/usr/local/keepalived # 指定安装路径/usr/local/keepalived
···省略Nsuse:/opt/keepalived-2.2.4 # make  执行make命令进行编译
···省略Nsuse:/opt/keepalived-2.2.4 # make install # 按Makefile定义好的路径拷贝至安装目录中
···省略Nsuse:~ # mkdir -p /etc/keepalived  # 在 /etc/下创建目录名为: keepalived
suse:~ # ll -d /etc/keepalived/
drwxr-xr-x 1 root root 0 Jul  8 10:58 /etc/keepalived/
suse:~ # # 复制keepalived.conf  到/etc/keepalived/目录下
suse:~ # cp -r /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
suse:~ # 
suse:~ # ll /etc/keepalived/keepalived.conf -d
-rw-r--r-- 1 root root 3550 Jul  8 10:59 /etc/keepalived/keepalived.conf
suse:~ # suse:~ # cd /usr/local/keepalived/
suse:/usr/local/keepalived # ll
total 0
drwxr-xr-x 1 root root 14 Jul  8 10:55 bin
drwxr-xr-x 1 root root 38 Jul  8 10:55 etc
drwxr-xr-x 1 root root 20 Jul  8 10:55 sbin
drwxr-xr-x 1 root root 20 Jul  8 10:55 share
suse:/usr/local/keepalived # # 配置 keepalived.conf  文件
suse:~ # cd /etc/keepalived/
suse:/etc/keepalived # cat keepalived.conf 
! Configuration File for keepalivedglobal_defs {router_id test-1
}vrrp_instance VI_1 {state MASTERinterface eth0virtual_router_id 51priority 100advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {192.168.192.100}
}
virtual_server 192.168.192.100 3306 {delay_loop 6lb_algo rrlb_kind NATpersistence_timeout 50protocol TCPreal_server 192.168.192.150 3306 {weight 1TCP_CHECK {connect_timeout 3nb_get_retry 3delay_before_retry 3connect_port 3306}}
#    real_server 192.168.192.151 3306 {  # 如果有多个数据库就把注释取消掉
#       weight 1
#        TCP_CHECK {
#        connect_timeout 3
#        nb_get_retry 3
#        delay_before_retry 3
#        connect_port 3306
#        }
#    }
}
suse:/etc/keepalived # suse:~ # systemctl daemon-reload # 重新加载
suse:~ # 
suse:~ # systemctl status keepalived.service # 查看状态
● keepalived.service - LVS and VRRP High Availability MonitorLoaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled)Active: inactive (dead)Docs: man:keepalived(8)man:keepalived.conf(5)man:genhash(1)https://keepalived.org
suse:~ # 
suse:~ # systemctl start keepalived.service  # 启动keepalived
suse:~ # 
suse:~ # systemctl status keepalived.service 
● keepalived.service - LVS and VRRP High Availability MonitorLoaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled)Active: active (running) since Sat 2023-07-08 11:09:56 CST; 4s agoDocs: man:keepalived(8)man:keepalived.conf(5)man:genhash(1)https://keepalived.orgProcess: 44880 ExecStart=/usr/local/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)Main PID: 44881 (keepalived)Tasks: 2 (limit: 512)CGroup: /system.slice/keepalived.service├─44881 /usr/local/keepalived/sbin/keepalived -D└─44882 /usr/local/keepalived/sbin/keepalived -D
···省略Nsuse:~ # ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:70:2e:ec brd ff:ff:ff:ff:ff:ffinet 192.168.192.150/24 brd 192.168.192.255 scope global eth0valid_lft forever preferred_lft foreverinet 192.168.192.100/32 scope global eth0  # VIPvalid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fe70:2eec/64 scope link valid_lft forever preferred_lft forever
suse:~ # 

报错信息:

使用 wget 下载keepalived 报错
# 下载keepalived 报错
suse:/opt # wget https://keepalived.org/software/keepalived-2.2.4.tar.gz
--2023-07-08 10:04:06--  https://keepalived.org/software/keepalived-2.2.4.tar.gz
Resolving keepalived.org (keepalived.org)... 91.121.30.175
Connecting to keepalived.org (keepalived.org)|91.121.30.175|:443... connected.
ERROR: cannot verify keepalived.org's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:Issued certificate has expired.
To connect to keepalived.org insecurely, use `--no-check-certificate'.
解决 使用 wget 下载 keepalived的报错
suse:/opt # wget https://keepalived.org/software/keepalived-2.2.4.tar.gz --no-check-certificate

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

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

相关文章

Oracle表空间和用户

Oracle表空间和用户 前言 1、创建表空间 2、 删除表空间 3、创建用户 4、用户赋权限 5、Oracle三个重要的角色 1、创建表空间 ORACLE 数据库的逻辑单元。 一个表空间可以与多个数据文件&#xff08;物理结构&#xff09;关联 一个数据库下可以建立多个表空间&#xff0c;一个表…

什么是操作系统

操作系统&#xff08;Operating System&#xff09; 什么是操作系统 操作系统是一组做计算机资源管理的软件的统称。目前常见的操作系统有&#xff1a;Windows系列、Unix系列、Linux系列、OSX系列、Android系列、iOS系列、鸿蒙等 操作系统的定位 操作系统的基本功能 操作系统由…

Vue3setup的参数说明

setup的两个参数 setup包含两个参数&#xff0c;一个为props、一个为context &#xff08;均为形参&#xff09; props&#xff1a;值为对象&#xff0c;包含&#xff1a;组件外部传递过来&#xff0c;且组件内部声明接收了的属性。context&#xff1a;上下文对象 <scrip…

基于springboot+Redis的前后端分离项目之消息队列(六)-【黑马点评】

&#x1f381;&#x1f381;资源文件分享 链接&#xff1a;https://pan.baidu.com/s/1189u6u4icQYHg_9_7ovWmA?pwdeh11 提取码&#xff1a;eh11 秒杀优化、消息队列 秒杀优化1 秒杀优化-异步秒杀思路2 秒杀优化-Redis完成秒杀资格判断3 秒杀优化-基于阻塞队列实现秒杀优化 Red…

MySQL第三天(简单单表查询)

前言 今天的三个题目是针对于单表查询和多表查询的课后作业&#xff0c;针对于初学者还是很合适的听有用处的&#xff0c;我会把我的答题过程一步一步写出来&#xff0c;有需要的小伙伴可以参考哦… 第一题、单表信息查询 题目代码如下&#xff1a; 作业&#xff1a;1.创建表…

遗传算法核心理解,python代码

遗传算法的核心&#xff0c;就在于&#xff0c;把待求的变量转化成二进制串&#xff0c;二进制串就像dna&#xff0c;可以对它的其中某几位进行交换&#xff0c;变异等操作&#xff0c;然后再转换回十进制&#xff0c;带入目标函数&#xff0c;计算适应度&#xff0c;保留适应度…

MySQL-分库分表详解(三)

♥️作者&#xff1a;小刘在C站 ♥️个人主页&#xff1a; 小刘主页 ♥️努力不一定有回报&#xff0c;但一定会有收获加油&#xff01;一起努力&#xff0c;共赴美好人生&#xff01; ♥️学习两年总结出的运维经验&#xff0c;以及思科模拟器全套网络实验教程。专栏&#xf…

Java csv文件上传下载中的相关转换

目录 一. 需求二. List<Entity>转List<List<String>>2.1 实体类2.2 转换 三. 上传csv文件转List<Map>3.1 csv文件3.2 前台3.3 实体类3.4 转换3.5 效果 一. 需求 &#x1f914;项目中遇到了两个需求 1.查询数据库&#xff0c;得到List<Entity>这…

[NISACTF 2022]checkin

[NISACTF 2022]checkin 直接给了源码&#xff0c;乍一看非常的简单&#xff0c;但是这题有坑。其实看注释颜色不一样&#xff0c;也能发现不对劲了。 贴一个payload&#xff0c;?ahahahahajitanglailo&%E2%80%AE%E2%81%A6Ugeiwo%E2%81%A9%E2%81%A6cuishiyuan%E2%80%AE%E2…

【lambda函数】lambda()函数

lambda&#xff08;&#xff09; lambda&#xff08;&#xff09;语法捕捉列表mutable lambda 底层原理函数对象与lambda表达式 lambda&#xff08;&#xff09;语法 lambda表达式书写格式&#xff1a; [capture-list] (parameters) mutable -> return-type{ statement }咱…

uniapp学习之【uniapp的返回事件 onBackPress 在微信小程序中不生效的问题】

uniapp 的返回事件 onBackPress 在微信小程序中不生效的问题 场景&#xff1a;页面中点击左上角的返回按钮,监听返回操作,页面返回前执行了一些操作, uniapp 页面生命周期中有 onBackPress ,因此将操作写在了 onBackPress () 页面生命周期钩子当中, H5 测试一切正常,但是微信开…

认识文件操作与IO

文章目录 认识文件文件夹文件路径文件分类 文件操作File类构造方法常用方法 字节流IOInputStream常用方法 FileInputStream构造方法FileInputStream实例 OutputStream方法 FileOutputStream 字符流IO 认识文件 我们平时所说的文件指的是存在硬盘上的文件&#xff0c;我们平时的…