redis&mariadb + keepalived 高可用

2023-11-08

目录

机器准备

安装后服务

redis

安装redis

mariadb

安装mariadb

启动和配置

互为主从同步配置

keepalived

keepalived安装

修改主从 keepalived的配置

主从配置-mariadb监控

主从配置-redis监控

查看和使用

Keepalived

Mariadb

redis


机器准备

两台机器:172.171.16.108-109   

操作系统 :centos7.6

两个虚拟ip :172.171.16.110-111

关闭防火墙

关闭防火墙

//临时关闭

systemctl stop firewalld

//禁止开机启动

systemctl disable firewalld

安装后服务

172.171.16.108

主数据库:Mariadb 10.5  3306  root  123456

主redis:Redis5.05  6379  123456

Keepalived

172.171.16.109

主数据库:Mariadb 10.5  3306  root  123456

从redis:Redis5.05  6379  123456  

Keepalived

Mariadb 虚拟ip  172.171.16.110

Redis虚拟ip  172.171.16.111

redis

安装redis

1.下载redis,并解压到/home/redis/目录下

mkdir /home/redis/

cd /home/redis/

wget http://download.redis.io/releases/redis-5.0.5.tar.gz

tar -xzvf redis-5.0.5.tar.gz

2.安装编译环境

yum -y install make automake cmake gcc g++

cd /home/redis/redis-5.0.5/

3.编译安装redis

make && make install

4、配置开机自启

vi /etc/systemd/system/redis.service

[Unit]

Description=redis-server

After=network.target



[Service]

Type=forking

ExecStart= /home/redis/redis-5.0.5/src/redis-server /home/redis/redis-5.0.5/redis.conf

PrivateTmp=true



[Install]

WantedBy=multi-user.target

ExecStart=/opt/software/redis-6.2.6/src/redis-server :启动服务的命令的位置
/etc/redis.conf 配置文件命令的位置

systemctl daemon-reload

systemctl enable redis

5.修改两台服务器上的redis配置文件,绑定所有ip,后台方式运行进程,设置密码

vim redis.conf

主库  172.171.16.108

bind 0.0.0.0

protected-mode no

pidfile  /home/redis/redis_6379.pid

daemonize yes

dir /home/redis

logfile "/home/redis/redis_6379.log"

requirepass 123456

从库  172.171.16.109

bind 0.0.0.0

protected-mode no

pidfile  /home/redis/redis_6379.pid

daemonize yes

dir /home/redis

logfile "/home/redis/redis_6379.log"

requirepass 123456



replicaof 172.171.16.108 6379

masterauth 123456

命令

# 启动

systemctl start redis

# 停止

systemctl stop redis

# 重启

systemctl restart redis

# 查看状态

systemctl status redis

mariadb

安装mariadb

查看已安装的包

命令:rpm -qa | grep mysql

如果存在已安装,逐个卸载掉这些包

命令:rpm -e --nodeps

配置yum源,并yum安装

vi /etc/yum.repos.d/MariaDB.repo

# MariaDB 10.5.9 CentOS repository list
# http://downloads.mariadb.org/mariadb/repositories/

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

yum update

yum install MariaDB-server MariaDB-client

配置两台服务器上的数据库配置文件

vim /etc/my.cnf.d/server.cnf

主库  172.171.16.108

#

# These groups are read by MariaDB server.

# Use it for options that only the server (but not clients) should see

#

# See the examples of server my.cnf files in /usr/share/mysql/

#



# this is read by the standalone daemon and embedded servers

[server]



# this is only for the mysqld standalone daemon

[mysqld]

skip-name-resolve



#event_scheduler=ON

datadir=/home/mariadb

socket=/home/mariadb/mysql.sock

slow_query_log=on

slow_query_log_file=/home/mariadb/slow_query_log.log

long_query_time=10

max_allowed_packet=512M

max_connections=1000

character-set-server=utf8mb4

collation-server=utf8mb4_general_ci

lower_case_table_names=0



#skip_name_resolve=ON

innodb_file_per_table=ON

server-id=108

log-bin=mysql-bin

log-bin-index=master-bin.index



# ignored databases

binlog-ignore-db=mysql

binlog-ignore-db=information_schema

binlog-ignore-db=performance_schema

# ignored tables

# #replicate-ignore-table=test



auto-increment-increment=2

auto-increment-offset=1

slave-skip-errors=all

relay_log=slave_relay_bin



wait_timeout=31536000

interactive_timeout=31536000

thread_pool_size=128

thread_pool_stall_limit=10



# Specifies the number of days before automatic removal of binary log files

expire_logs_days=30



#

# * Galera-related settings

#

[galera]

# Mandatory settings

#wsrep_on=ON

#wsrep_provider=

#wsrep_cluster_address=

#binlog_format=row

#default_storage_engine=InnoDB

#innodb_autoinc_lock_mode=2

#

# Allow server to accept connections on all interfaces.

#

#bind-address=0.0.0.0

#

# Optional setting

#wsrep_slave_threads=1

#innodb_flush_log_at_trx_commit=0



innodb_flush_log_at_trx_commit=0

innodb_autoextend_increment=128M

innodb_log_buffer_size=16M

innodb_log_file_size=128M



# this is only for embedded server

[embedded]



# This group is only read by MariaDB servers, not by MySQL.

# If you use the same .cnf file for MySQL and MariaDB,

# you can put MariaDB-only options here

[mariadb]



# This group is only read by MariaDB-10.5 servers.

# If you use the same .cnf file for MariaDB of different versions,

# use this group for options that older servers don't understand

[mariadb-10.5]

主库  172.171.16.109

#

# These groups are read by MariaDB server.

# Use it for options that only the server (but not clients) should see

#

# See the examples of server my.cnf files in /usr/share/mysql/

#



# this is read by the standalone daemon and embedded servers

[server]



# this is only for the mysqld standalone daemon

[mysqld]

skip-name-resolve



#event_scheduler=ON

datadir=/home/mariadb

socket=/home/mariadb/mysql.sock

slow_query_log=on

slow_query_log_file=/home/mariadb/slow_query_log.log

long_query_time=10

max_allowed_packet=512M

max_connections=1000

character-set-server=utf8mb4

collation-server=utf8mb4_general_ci

lower_case_table_names=0



#skip_name_resolve=ON

innodb_file_per_table=ON

server-id=109

log-bin=mysql-bin

log-bin-index=master-bin.index



# ignored databases

binlog-ignore-db=mysql

binlog-ignore-db=information_schema

binlog-ignore-db=performance_schema

# ignored tables

# #replicate-ignore-table=test



auto-increment-increment=2

auto-increment-offset=2

slave-skip-errors=all

relay_log=slave_relay_bin



wait_timeout=31536000

interactive_timeout=31536000

thread_pool_size=128

thread_pool_stall_limit=10



# Specifies the number of days before automatic removal of binary log files

expire_logs_days=30



#

# * Galera-related settings

#

[galera]

# Mandatory settings

#wsrep_on=ON

#wsrep_provider=

#wsrep_cluster_address=

#binlog_format=row

#default_storage_engine=InnoDB

#innodb_autoinc_lock_mode=2

#

# Allow server to accept connections on all interfaces.

#

#bind-address=0.0.0.0

#

# Optional setting

#wsrep_slave_threads=1

#innodb_flush_log_at_trx_commit=0



innodb_flush_log_at_trx_commit=0

innodb_autoextend_increment=128M

innodb_log_buffer_size=16M

innodb_log_file_size=128M



# this is only for embedded server

[embedded]



# This group is only read by MariaDB servers, not by MySQL.

# If you use the same .cnf file for MySQL and MariaDB,

# you can put MariaDB-only options here

[mariadb]



# This group is only read by MariaDB-10.5 servers.

# If you use the same .cnf file for MariaDB of different versions,

# use this group for options that older servers don't understand

[mariadb-10.5]



创建数据库目录,并将原有的数据库目录下文件复制到新的目录下,给sock文件设置软连接

mkdir /home/mariadb

chown -R mysql:mysql /home/mariadb

cp -a /var/lib/mysql/*     /home/mariadb

ln -s /home/mariadb/mysql.sock /var/lib/mysql/mysql.sock

启动和配置

命令

systemctl start mariadb  #启动MariaDB
systemctl stop mariadb  #停止MariaDB
systemctl restart mariadb  #重启MariaDB
systemctl enable mariadb  #设置开机启动

对两台服务器上的数据库做初始化配置

mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!



In order to log into MariaDB to secure it, we'll need the current

password for the root user. If you've just installed MariaDB, and

haven't set the root password yet, you should just press enter here.



Enter current password for root (enter for none):

OK, successfully used password, moving on...



Setting the root password or using the unix_socket ensures that nobody

can log into the MariaDB root user without the proper authorisation.



You already have your root account protected, so you can safely answer 'n'.



Switch to unix_socket authentication [Y/n] n

 ... skipping.



You already have your root account protected, so you can safely answer 'n'.



Change the root password? [Y/n] y

New password:

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

 ... Success!





By default, a MariaDB installation has an anonymous user, allowing anyone

to log into MariaDB without having to have a user account created for

them.  This is intended only for testing, and to make the installation

go a bit smoother.  You should remove them before moving into a

production environment.



Remove anonymous users? [Y/n] y

 ... Success!



Normally, root should only be allowed to connect from 'localhost'.  This

ensures that someone cannot guess at the root password from the network.



Disallow root login remotely? [Y/n] n

 ... skipping.



By default, MariaDB comes with a database named 'test' that anyone can

access.  This is also intended only for testing, and should be removed

before moving into a production environment.



Remove test database and access to it? [Y/n] y

 - Dropping test database...

 ... Success!

 - Removing privileges on test database...

 ... Success!



Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.



Reload privilege tables now? [Y/n] y

 ... Success!



Cleaning up...



All done!  If you've completed all of the above steps, your MariaDB

installation should now be secure.



Thanks for using MariaDB!

设置远程登录 ,并更新生效

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;

互为主从同步配置

保持 108 和 109 上的数据库、表完全一致

通过执行如下sql 设置两台数据库互相同步

108认为是master1  需要同步master2

change master 'master2' to master_host='172.171.16.109',master_port=3306,master_user='root',master_password='123456';

start SLAVE 'master2';

show all slaves status;

109认为是master2  需要同步master1

change master 'master1' to master_host='172.171.16.108',master_port=3306,master_user='root',master_password='123456';

start SLAVE 'master1';

show all slaves status;

keepalived

keepalived安装

卸载

查找安装目录

[root@CentOS-003 keepalived]# find / -name keepalived

删除安装目录

rm -rf /etc/sysconfig/keepalived

rm -rf /etc/keepalived

rm -rf /var/lib/selinux/targeted/active/modules/100/keepalived

rm -rf /usr/sbin/keepalived

rm -rf /usr/share/doc/keepalived

rm -rf /usr/share/selinux/targeted/default/active/modules/100/keepalived

rm -rf /usr/libexec/keepalived

rm -rf /etc/selinux/targeted/active/modules/100/keepalived

查看进程

[root@CentOS-001 /]#  ps aux|grep keepalived

创建目录

mkdir /home/keepalived

cd  /home/keepalived

下载压缩包 keepalived-2.0.20.tar.gz 并放在该目录下

解压

tar xvf keepalived-2.0.20.tar.gz

安装

[root@CentOS-003 opt]# cd keepalived-2.0.20/

[root@CentOS-003 keepalived-2.0.20]#  ./configure --prefix=/usr/local/keepalived

如果报错

configure: error:

  !!! OpenSSL is not properly installed on your system. !!!

  !!! Can not include OpenSSL headers files.            !!!

Yum安装解决

yum -y install openssl openssl-devel

解决后继续执行命令

[root@CentOS-003 keepalived-2.0.20]#  ./configure --prefix=/usr/local/keepalived

[root@CentOS-003 keepalived-2.0.20]# make & make install

# keepalived 启动脚本变量引用文件,默认文件路径是 /etc/sysconfig/,也可以不做软链接,直接修改启动脚本中文件路径即可(安装目录下)

[root@CentOS-001 keepalived-2.0.20]# cp /usr/local/keepalived/etc/sysconfig/keepalived  /etc/sysconfig/keepalived



# 将keepalived 主程序加入到环境变量(安装目录下)

[root@CentOS-001 keepalived-2.0.20]# cp /usr/local/keepalived/sbin/keepalived /usr/sbin/keepalived



# keepalived 启动脚本(源码目录下),放到 /etc/init.d/ 目录下就可以使用 service 命令便捷调用



[root@CentOS-001 keepalived-2.0.20]# cp /home/keepalived/keepalived-2.0.20/keepalived/etc/init.d/keepalived  /etc/init.d/keepalived

# 将配置文件放到默认路径下

[root@CentOS-001 keepalived-2.0.20]# mkdir /etc/keepalived

[root@CentOS-001 keepalived-2.0.20]# cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf

chmod 644 /etc/keepalived/keepalived.conf

启动

[root@CentOS-001 keepalived-2.0.20]# service keepalived start

日志位置

[root@CentOS-001 log]# tail -f /var/log/messages

加为系统服务:chkconfig --add keepalived

开机启动:chkconfig keepalived on

查看开机启动的服务:chkconfig --list

启动、关闭、重启 service keepalived start|stop|restart

ip a show |grep -w inet

修改主从 keepalived的配置

vim /etc/keepalived/keepalived.conf

主库  172.171.16.108


global_defs {
	router_id redis-mysql-master
	script_user root
	enable_script_security
}

vrrp_script chk_mysql
{
	#监控脚本
	script "/home/keepalived-scripts/mysql/mysql_check.sh"
	#监控时间,脚本的执行时间间隔
	interval 2
	#超时时间
	timeout 2
	weight -15
	#3次失败才算失败,会用weight减少优先级(1-255之间)
	fall 3
	#1次成功就算成功,但不修改优先级
	rise 1
}

vrrp_script chk_redis
{
	#监控脚本
	script "/home/keepalived-scripts/redis/redis_check.sh"
	#监控时间,脚本的执行时间间隔
	interval 2
	#超时时间
	timeout 2
	weight -15
	#3次失败才算失败,会用weight减少优先级(1-255之间)
	fall 3
	#1次成功就算成功,但不修改优先级
	rise 1
}


vrrp_instance VI_1 {
	#设置为MASTER
	state MASTER
	#本机监控网卡
	interface ens192
        # garp_master_delay 10
	#主从需要在同一路由编号
	virtual_router_id 55
	#权重值
    	priority 100
	#默认抢占
    	#nopreempt
	#vrrp通告的时间间隔,默认1s
	advert_int 1
	authentication {
		#加密
		auth_type PASS
		#密码
 		auth_pass 123456
	}

	virtual_ipaddress {
		#Keppalived虚拟出来的VIP
		172.171.16.110
	}

	track_script {
		chk_mysql
	}
}

vrrp_instance VI_2 {
        #设置为MASTER
	state MASTER
	#本机监控网卡
	interface ens192
	#主从需要在同一路由编号
	virtual_router_id 60
	#权重值
    	priority 100
	#vrrp通告的时间间隔,默认1s
	advert_int 5
	authentication {
		#加密
		auth_type PASS
		#密码
 		auth_pass 123456
	}

	virtual_ipaddress {
		#Keppalived虚拟出来的VIP
		172.171.16.111
	}

	track_script {
		chk_redis
	}

	#keepalived成为master
	notify_master /home/keepalived-scripts/redis/redis_master.sh
	#keepalived成为backup
	notify_backup /home/keepalived-scripts/redis/redis_slave.sh
	#keepalived fault时
	notify_fault /home/keepalived-scripts/redis/redis_fault.sh
	#keepalived服务中止时
	notify_stop /home/keepalived-scripts/redis/redis_stop.sh

}

主库  172.171.16.109


global_defs {
        router_id redis-mysql-slave
        script_user root
        enable_script_security
}

vrrp_script chk_mysql
{
        #监控脚本
        script "/home/keepalived-scripts/mysql/mysql_check.sh"
        #监控时间,脚本的执行时间间隔
        interval 2
        #超时时间
        timeout 2
        weight -15
        #3次失败才算失败,会用weight减少优先级(1-255之间)
        fall 3
        #1次成功就算成功,但不修改优先级
        rise 1
}

vrrp_script chk_redis
{       
        #监控脚本
        script "/home/keepalived-scripts/redis/redis_check.sh"
        #监控时间,脚本的执行时间间隔
        interval 2
        #超时时间
        timeout 2
        weight -15
        #3次失败才算失败,会用weight减少优先级(1-255之间)
        fall 3
        #1次成功就算成功,但不修改优先级
        rise 1
}


vrrp_instance VI_1 {
        #设置为BACKUP
        state BACKUP
        #本机监控网卡
        interface em1
#   garp_master_delay 10
        #主从需要在同一路由编号
        virtual_router_id 55
        #权重值
        priority 90
        #默认抢占
        #nopreempt
        #vrrp通告的时间间隔,默认1s
        advert_int 1
        authentication {
                #加密
                auth_type PASS
                #密码
                auth_pass 123456
        }

        virtual_ipaddress {
                #Keppalived虚拟出来的VIP
                172.171.16.110
        }

        track_script {
                chk_mysql
        }
}

vrrp_instance VI_2 {
        #设置为BACKUP
        state BACKUP
        #本机监控网卡
        interface em1
        #主从需要在同一路由编号
        virtual_router_id 60
        #权重值
        priority 90
        #vrrp通告的时间间隔,默认1s
        advert_int 5
        authentication {
                #加密
                auth_type PASS
                #密码
                auth_pass 123456
        }

        virtual_ipaddress {
                #Keppalived虚拟出来的VIP
                172.171.16.111
        }

        track_script {
                chk_redis
        }

        #keepalived成为master
        notify_master /home/keepalived-scripts/redis/redis_master.sh
        #keepalived成为backup
        notify_backup /home/keepalived-scripts/redis/redis_slave.sh
        #keepalived fault时
        notify_fault /home/keepalived-scripts/redis/redis_fault.sh
        #keepalived服务中止时
        notify_stop /home/keepalived-scripts/redis/redis_stop.sh

}

主从配置-mariadb监控

创建监控脚本目录,用来放监控脚本文件

mkdir /home/keepalived-scripts

mkdir /home/keepalived-scripts/mysql

cd  /home/keepalived-scripts/mysql

vim mysql_check.sh(当前目录的 /script目录下)

编辑mysql_check.sh脚本,108、109服务器一致

#!/bin/bash
MYSQL_HOST=localhost
MYSQL_USER=root
MYSQL_PASSWORD=123456
CHECK_TIME=3
#mysql is working MYSQL_OK is 1, mysql down MYSQL_OK is 0
MYSQL_OK=1
#select 1;
function check_mysql_helth() {
	mysqladmin -h $MYSQL_HOST -u $MYSQL_USER -p${MYSQL_PASSWORD} ping &>/dev/null
	if [ $? = 0 ] ;then
		MYSQL_OK=1
	else
 		MYSQL_OK=0
    	fi
	echo $MYSQL_OK
    	return $MYSQL_OK
}
while [ $CHECK_TIME -ne 0 ]
do
	let "CHECK_TIME -= 1"
   	check_mysql_helth
	if [ $MYSQL_OK = 1 ]; then
    		CHECK_TIME=0
    	exit 0
fi
if [ $MYSQL_OK -eq 0 ] &&  [ $CHECK_TIME -eq 0 ]
then
	exit 1
fi
sleep 2
done

主从配置-redis监控

mkdir /home/keepalived-scripts

mkdir /home/keepalived-scripts/redis

mkdir /home/keepalived-scripts/log

cd  /home/keepalived-scripts/ redis

vim 编辑如下脚本

/home/keepalived-scripts/redis/redis_master.sh
/home/keepalived-scripts/redis/redis_slave.sh
/home/keepalived-scripts/redis/redis_fault.sh
/home/keepalived-scripts/redis/redis_stop.sh

/home/keepalived-scripts/redis/redis_stop.sh

具体查看下面链接中资源

       keepalived 监测mysql&&redis 高可用配置和脚本icon-default.png?t=N5K3https://download.csdn.net/download/mengo1234/87954486

chmod +x /home/keepalived-scripts/redis/*

redis脚本日志所在位置:/home/keepalived-scripts/log

chmod +x /home/keepalived-scripts/mysql/*

查看和使用

Keepalived

启动、关闭、重启 service keepalived start|stop|restart

查看keepalived集群主节点在哪台服务器,执行命令:ip a

查看日志:tail -f /var/log/messages

Mariadb

systemctl start mariadb  #启动MariaDB
systemctl stop mariadb  #停止MariaDB
systemctl restart mariadb  #重启MariaDB
systemctl enable mariadb  #设置开机启动

redis

启动

systemctl start redis

# 停止

systemctl stop redis

# 重启

systemctl restart redis

# 查看状态

systemctl status redis

登录:redis-cli 

查看信息:Info

查看主从信息:info Replicatio

切换主从:replicaof NO ONE

replicaof 172.171.16.109 6379    108上redis从109

replicaof 172.171.16.108 6379    109上redis从108

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

redis&mariadb + keepalived 高可用 的相关文章

随机推荐

  • window子系统使用及问题汇总

    window子系统使用及问题汇总 安装 配置子系统的资源大小 切换默认源 安装docker 解决wsl无法使用systemctl的问题 子系统访问windows系统中的文件 window访问子系统的文件 总结 最近在使用windows上的d
  • nginx vue2+webpack 和 vue3+vite 配置二级目录访问

    我们开发中会遇到这样的需求 让我们用服务器nginx部署一个用域名的二级目录来访问项目 https xxx 二级目录 来放访问项目 目录 思路 1 nginx配置 vue2 和 vue3配置的nginx相同 2 vue2 webpack的配
  • 如何在IDEA设置Java类和方法的注释模板?

    如何在IDEA设置Java类和方法的注释模板 1 类的注释模板设置 首先我们打开IDEA软件 进行如下操作 File gt Settings gt Editor gt File and Code Templates 设置好后 当我们再次创建
  • 磁盘性能基本测试方法

    author skate time 2011 08 22 磁盘性能基本测试方法 dd if dev zero of tmp bs 1M count 10 用dd命令测试瞬间写的能力 iozone a i 1 i 0 c g 5M n 1M
  • PC电脑版微信聊天记录迁移方法

    微信电脑版自带的 备份与恢复 功能 只能把手机上的聊天记录 备份在电脑上 仅仅是备份 是不能在微信电脑版上查看刚备份的聊天记录的 备份后就可以删除手机上的聊天记录 需要的时候再用电脑版留存的备份恢复到手机上 适用场景 可自行琢磨 微信手机版
  • config:invalid signature

    之前服务器换了IP 啥都配置对了 就是IP没改过来 好了 又是花了半天时间排查问题 问题解决 微信config invalid signature 的其中一个错误就是ip地址问题 需在公众号后台 gt 基本配置 gt 设置IP白名单 欢迎关
  • Python time time()方法返回的是秒

    描述 Python time time 返回当前时间的时间戳 1970纪元后经过的浮点秒数 语法 time 方法语法 time time 参数 NA 返回值 返回当前时间的时间戳 1970纪元后经过的浮点秒数 实例 以下实例展示了 time
  • Linux目录操作命令

    1 查看目录命令 ls 用法 ls 选项 目录名 常用选项 a 显示所有文件 包含隐藏文件 l 显示长文件信息 案例 查看 user下的所有文件 ls a user ls 文件或目录路径信息 ls d 查看目录信息 ls l 文件或目录信息
  • Unity Shader入门精要文章目录

    前言 从今天开始 我将每天开始学习一些有关于Shader的知识 并把所学到的知识简化 写成文章来供大家参考或者学习 一方面是为了巩固知识 另一方面是我也没有找到什么系统的文章来学习Shader的知识 我的Shader学习大部分是参考了Uni
  • GDI+ 中路径类使用总结

    背景 路径是一系列相互连接的直线和曲线 由许多不同类型的点所构成 用于表示复杂的不规则图形 GraphicsPath 类表示 要绘制一组图形 如线条 矩形 多边形和曲线等 可以通过 Graphcis 类的 DrawPath 方法一次性绘制
  • 《Python进阶系列》二十六:面试题目:[lambda x: x*i for i in range(4)]

    quad quad 闲着无聊 看了道面试题 瞬间涨姿势了 特地做个总结 题目 题目如下 lst lambda x x i for i in range 4 res m 2 for m in lst print res 上述式子的输出结果 预
  • VirtualBox中出现 UUID have already exists : 修改 UUID

    VirtualBox中出现UUID have already exists 解决方法 要点 C Program Files Oracle VirtualBox VBoxManage exe internalcommands sethduui
  • C++——vector

    文章目录 vector的介绍 vector的使用 为什么vector不提供find 排序 sort vector的模拟实现 搭一个最简单的架子 构造函数和析构函数 尾插 尾删 operator 迭代器 insert erase 迭代器失效
  • [caffe安装]配置环境过程中出现的问题及解决

    今天要跑一下Convolutional Autoencoder for Loop Closure 轻量级神经网络闭环方法 caffe安好之后编译程序出现以下错误 Scanning dependencies of target deeplcd
  • React 之常用组件类型

    无状态组件 主要用于内部没有状态更新操作的组件 同构props进行基本的数据渲染或常量展示 该类组件职责单一 有利于组件的高复用 const PureComponent props gt div props list map txt ind
  • 金融市场概览

    文章目录 金融市场的功能 金融市场的分类 主要金融机构 中国金融市场概况 本文简要展现真实世界中的金融市场的面貌 介绍其基本结构 主要玩家 交易的主要资产 以及主要的业务形式 金融市场的功能 金融是通过交易金融资产来实现资金通融 很容易想到
  • Qt学习笔记3:Qt工程的目录结构

    经过前两篇的学习 已经可以使用Qt空项目模板创建自己的工程了 通过本篇的学习 整理一下如果使用Qt工程的目录结构 使项目更规范和容易管理 当前的目录结构 如图所示 这是前篇中创建的工程 只有main cpp和widget cpp widge
  • postman-接口批量执行、接口串联

    一 接口批量执行 1 点击postman左侧Collections下面有个添加文件夹图标 就可以创建测试项目 2 该目录下还可以创建子目录 进行测试用例的细分 3 创建测试用例 创建接口测试用例 即新建http请求 选择请求方式 写好url
  • 【AUTOSAR】CCP协议的代码分析与解读(四)----CCP协议数据下载和上传

    数据下载 DNLOAD DNLOAD指令负责将CRO中的数据下载到ECU中 起始地址为先前设定的MTA0 下载完毕后MTA0指针自增 自增的字数为下载的字节数 DNLOAD命令的CRO数据场结构 如下所示 位 置 类 型 描 述 0 字节
  • redis&mariadb + keepalived 高可用

    目录 机器准备 安装后服务 redis 安装redis mariadb 安装mariadb 启动和配置 互为主从同步配置 keepalived keepalived安装 修改主从 keepalived的配置 主从配置 mariadb监控 主