Redis单例部署

目录

  • 1. 概述
  • 2. 参考
  • 3. 环境
  • 4. 部署
    • 4.1 操作系统
      • 4.1.1 修改系统参数
      • 4.1.2 关闭透明大页内存
      • 4.1.3 修改系统限制
    • 4.2 安装Redis
      • 4.2.1 下载Redis
      • 4.2.2 创建redis账号
      • 4.2.3 添加Redis环境变量
      • 4.2.4 创建Redis使用目录
      • 4.2.5 安装Redis
      • 4.2.6 手动修改配置文件(**可跳过,直接使用4.2.7命令修改**)
      • 4.2.7 命令修改配置文件
      • 4.2.8 Redis使用目录赋权
      • 4.2.9 启动Redis验证
      • 4.2.10 目录结构
    • 4.3 配置systemd管理
      • 4.3.1 编译安装时未使用systemd
      • 4.3.2 编译安装时使用了systemd方式
      • 4.3.3 加载并验证服务
    • 4.3 部署常见问题
      • 4.3.1 编译时环境问题
      • 4.3.2 编译时缺少文件

1. 概述

之前一直使用Redis,最近遇到一些问题,整理Redis的单例安装部署过程,记录如下。

2. 参考

  1. 链接: Install Redis
  2. 链接: github-Redis
  3. 链接: gitcode-Redis

3. 环境

  • 虚机Virtual-Machine-203
  • Ubuntu 22.04(Centos7.9也可以)
  • Redis 7.2.5

4. 部署

4.1 操作系统

4.1.1 修改系统参数

  • 添加以下系统参数(必须)
cat >> /etc/sysctl.conf << EOF
# Redis 必须使用参数
#定义了系统中每一个端口最大的监听队列的长度,默认4096 可调整到8192/16384/32768
net.core.somaxconn = 32768

# Redis 必须使用参数
# 1表示内核允许分配所有的物理内存,而不管当前的内存状态如何,默认0。
vm.overcommit_memory = 1

# Redis 建议使用参数
# 物理内存使用90%,才开始使用swap,默认60,也可以设置为0,优先使用100%物理内存
vm.swappiness = 10

# 大于100将更积极的回收cache,默认100,
vm.vfs_cache_pressure = 100

EOF
  • 添加以下系统参数(可选)
cat >> /etc/sysctl.conf << EOF
# 系统调优参数
# 允许存在time_wait状态的最大数值,超过则立刻被清除并且警告 
# 默认是262144, ubuntu默认8192,防止过多的time_wait导致端口资源被耗尽
net.ipv4.tcp_max_tw_buckets = 30000

# 开启SYN Cookies,当出现SYN 等待队列溢出时,启用cookies 来处理。
net.ipv4.tcp_syncookies = 1

# 该参数决定了,每个网络接口接收数据包的速率比内核处理这些包的速率快时,允许送到队列的数据包的最大数目,默认1000
net.core.netdev_max_backlog = 32768

# 表示SYN队列的长度,默认2048
net.ipv4.tcp_max_syn_backlog = 32768

# 建立连接syn+ack 与syn 包重试次数
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2

EOF
  • 参数生效
sysctl -p

4.1.2 关闭透明大页内存

  • 关闭透明大页内存动态分配,需要关闭让 redis 或 mongo 负责内存管理
cat >> /etc/rc.local << EOF
# Redis Mongo建议参数
# Disable Transparent Huge Pages, redis and mongo configure
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
EOF
  • 加载生效
source /etc/rc.local

4.1.3 修改系统限制

cp /etc/security/limits.conf /etc/security/limits.conf.bak
cat>>/etc/security/limits.conf <<EOF
* soft nproc 655350
* hard nproc 655350
* soft nofile 655350
* hard nofile 655350

# ubuntu 需要针对账号设置
root soft nproc 655350
root hard nproc 655350
root soft nofile 655350
root hard nofile 655350
EOF
  • 重启或重新登录生效
  • 修改当前设置生效
ulimit -n 655350 
ulimit -u 655350 

4.2 安装Redis

4.2.1 下载Redis

  • 从官网或 github下载,需要看一下版本,选择没有重大安全问题的版本
    • https://github.com/redis/redis/releases
    • http://download.redis.io/releases/redis-7.2.5.tar.gz
wget http://download.redis.io/releases/redis-7.2.5.tar.gz

4.2.2 创建redis账号

useradd -s /sbin/nologin redis

4.2.3 添加Redis环境变量

  • 确定Redis安装路径,例如/usr/local/redis7.2.5
  • 增加环境变量 REDIS_HOME ,不要与已有路径冲突
cat >>/etc/profile<<EOF

export REDIS_HOME=/usr/local/redis7.2.5
PATH=\$REDIS_HOME/bin:\$PATH
export PATH
EOF
  • 加载生效,查看路径
source /etc/profile && echo $PATH

4.2.4 创建Redis使用目录

  • 创建Redis使用目录
    • /usr/local/redis7.2.5(REDIS_HOME):程序存放目录
    • /var/log/redis:日志存放目录
    • /var/run/redis:服务PID存放目录
    • /etc/redis:配置文件存放目录(可选),当前默认存放在“程序存放目录”下
mkdir -p ${REDIS_HOME} && chown -R redis:redis ${REDIS_HOME}
mkdir -p /var/log/redis && chown redis:redis /var/log/redis
mkdir -p /var/run/redis && chown -R redis:redis /var/run/redis
# mkdir -p /etc/redis && chown -R redis:redis /etc/redis

4.2.5 安装Redis

安装可以根据Redis服务启动管理,选择安装方式。可提供以下几种方式,供选择:

  1. 使用systemctl命令管理(Centos7、Ubuntu),编译安装时指定 USE_SYSTEMD=yes 选项,配置systemd服务管理文件时Type使用notify
  2. 使用systemctl命令管理(Centos7、Ubuntu),编译安装,配置systemd服务管理文件时Type使用simple
  3. 使用service命令管理(Centos6),编译安装,配置/etc/init.d下启动文件
  • Ubuntu支持systemd方式编译安装,能够支持Type=notify
    • PREFIX 指定安装路径
    • USE_SYSTEMD 支持systemd
# Ubuntu 安装
tar -zxvf redis-7.2.5.tar.gz && cd redis-7.2.5
# 安装依赖包
apt install -y libsystemd-dev pkg-config
# 可以使用支持systemd方式编译安装,能够支持Type=notify
make PREFIX=${REDIS_HOME} USE_SYSTEMD=yes install
  • Centos支持systemd方式编译安装,能够支持Type=notify
    • PREFIX 指定安装路径
    • USE_SYSTEMD 支持systemd
# Centos 安装
tar -zxvf redis-7.2.5.tar.gz && cd redis-7.2.5
# 安装依赖包
yum install -y systemd-notify-devel 
# 可以使用支持systemd方式编译安装,能够支持Type=notify
make PREFIX=${REDIS_HOME} USE_SYSTEMD=yes install
  • 其他编译安装,可用于service命令(如Centos6)或systemd的simple
    • PREFIX 指定安装路径
tar -zxvf redis-6.2.9.tar.gz && cd redis-6.2.9
make PREFIX=${REDIS_HOME} install
  • 验证安装版本
${REDIS_HOME}/bin/redis-server --version

4.2.6 手动修改配置文件(可跳过,直接使用4.2.7命令修改

  • 拷贝配置文件到安装路径下并修改。
cp ./redis.conf ${REDIS_HOME}/ && cd ${REDIS_HOME}
  • 修改监听地址,IPv4和IPv6均监听
#bind 127.0.0.1 -::1
bind * -::*
  • 根据需要修改监听端口
# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379
  • 修改监听队列长度,小于sysctl.conf文件中的somaxconn 设置
# In high requests-per-second environments you need a high backlog in order
# to avoid slow clients connection issues. Note that the Linux kernel
# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
# in order to get the desired effect.
#tcp-backlog 511
tcp-backlog 4096
  • timeout保持不变,配合应用程序保持长连接。
    注意它不是超时连接,它是空闲后等待多久后关闭。
# Close the connection after a client is idle for N seconds (0 to disable)
timeout 0
  • tcp-keepalive保持不变
    服务端于探测客户端的检测时间周期。可根据需要调整
tcp-keepalive 300
  • 启动后台运行
#daemonize no
daemonize yes
  • 修改pid文件路径
#pidfile /var/run/redis_6379.pid
pidfile /var/run/redis/redis_6379.pid
  • 修改日志文件路径
#logfile ""
logfile "/var/log/redis/redis_6379.log"
  • 修改snapshotting配置
    需要综合考虑数据是否允许丢失和写入rdb的频率。
    这里是允许数据丢失的,而且变更的频次不高,所以只修改了900秒内有500个变更的值
################################ SNAPSHOTTING  ################################

# Save the DB to disk.
#
# You can set these explicitly by uncommenting the following line.
#
# save 3600 1 300 100 60 10000
save 3600 1 900 500 60 10000
  • 修改了dump.rdb的文件名称
# The filename where to dump the DB
 dbfilename dump_6379.rdb
  • 修改了dump.rdb的存储路径
    注意路径是否有足够的磁盘空间。最合理方式应该存储在单独的数据分区,创建目录并给redis账号赋权
# dir ./
dir /usr/local/redis/
  • 修改连接密码
# requirepass foobared
 requirepass yourpassword
  • 重命名危险命令
    • config命令使用别名
    • 其它命令被禁用
# rename-command CONFIG ""
 rename-command CONFIG "kkconfig"
 rename-command FLUSHALL ""
 rename-command FLUSHDB ""
 rename-command DEBUG ""
  • 修改最大客户端连接数
# maxclients 10000
maxclients 50000
  • 修改最大内存限制
    如果是redis专用服务器,建议不超过物理内存的3/4
# maxmemory <bytes>
maxmemory 32GB
  • 保持淘汰策略不变-不淘汰
    通常情况下应该选择一个淘汰策略,而不是不淘汰
# maxmemory-policy noeviction
  • 打开异步操作,防止单线程阻塞
    • lazyfree-lazy-eviction:表示当 Redis 运行内存超过 maxmeory 时,是否开启 lazy free 机制删除;
    • lazyfree-lazy-expire:表示设置了过期时间的键值,当过期之后是否开启 lazy free 机制删除;
    • lazyfree-lazy-server-del:有些指令在处理已存在的键时,会带有一个隐式的 del 键的操作,比如 rename 命令,当目标键已存在,Redis 会先删除目标键,如果这些目标键是一个 big key,就会造成阻塞删除的问题,此配置表示在这种场景中是否开启 lazy free 机制删除;
    • slave-lazy-flush:针对 slave(从节点) 进行全量数据同步,slave 在加载 master 的 RDB 文件前,会运行 flushall 来清理自己的数据,它表示此时是否开启 lazy free 机制删除。
    • lazyfree-lazy-user-del:表示是否将 DEL 指令的默认行为替换成 lazy free 机制删除,效果就跟 UNLINK 一样。
############################# LAZY FREEING ####################################
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
lazyfree-lazy-user-del yes
  • 修改慢查询日志设置
################################## SLOW LOG ###################################
# 修改为20000微秒,默认是10000微秒
slowlog-log-slower-than 20000
# 修改为保存1000条记录,默认128条
slowlog-max-len 1000

4.2.7 命令修改配置文件

  • 拷贝配置文件到安装路径下并修改。
cp ./redis.conf ${REDIS_HOME}/ && cd ${REDIS_HOME}
  • 先定义以下变量
    • PORT: Redis服务监听端口
    • MAXMEMORY:Redis服务最大内存限制
    • YPWD:Redis服务密码
cd ${REDIS_HOME}
PORT=6379
MAXMEMORY='32GB'
YPWD='yourpassword'
sed -i "s|bind 127.0.0.1 -::1| bind * -::* |" ./redis.conf \
&& sed -i "s|port 6379| port ${PORT}|" ./redis.conf \
&& sed -i "s|tcp-backlog 511| tcp-backlog 4096|" ./redis.conf \
&& sed -i "s|daemonize no| daemonize yes|" ./redis.conf \
&& sed -i "s|pidfile /var/run/redis_6379.pid| pidfile /var/run/redis/redis_${PORT}.pid|" ./redis.conf \
&& sed -i "s|logfile \"\"| logfile \"/var/log/redis/redis_${PORT}.log\"|" ./redis.conf \
&& sed -i "s|# save 3600 1 300 100 60 10000| save 3600 1 900 500 60 10000|" ./redis.conf \
&& sed -i "s|# save 3600 1| save 3600 1|" ./redis.conf \
&& sed -i "s|# save 300 100| save 900 500|" ./redis.conf \
&& sed -i "s|# save 60 10000| save 60 10000|" ./redis.conf \
&& sed -i "s|dbfilename dump.rdb| dbfilename dump_${PORT}.rdb|" ./redis.conf \
&& sed -i "s|dir ./| dir ${REDIS_HOME}/|" ./redis.conf \
&& sed -i "s|# requirepass foobared| requirepass ${YPWD}|" ./redis.conf \
&& sed -i "/# rename-command CONFIG \"\"/ a\\ rename-command CONFIG 'xkconfig'\n rename-command FLUSHALL ''\n rename-command FLUSHDB ''\n rename-command DEBUG ''\n"  ./redis.conf \
&& sed -i "s|# maxclients 10000| maxclients 50000|" ./redis.conf \
&& sed -i "s|# maxmemory <bytes>| maxmemory ${MAXMEMORY}|" ./redis.conf \
&& sed -i "s|lazyfree-lazy-eviction no| lazyfree-lazy-eviction yes|" ./redis.conf \
&& sed -i "s|lazyfree-lazy-expire no| lazyfree-lazy-expire yes|" ./redis.conf \
&& sed -i "s|lazyfree-lazy-server-del no| lazyfree-lazy-server-del yes|" ./redis.conf \
&& sed -i "s|replica-lazy-flush no| replica-lazy-flush yes|" ./redis.conf \
&& sed -i "s|lazyfree-lazy-user-del no| lazyfree-lazy-user-del yes|" ./redis.conf \
&& sed -i "s|slowlog-log-slower-than 10000| slowlog-log-slower-than 20000|" ./redis.conf \
&& sed -i "s|slowlog-max-len 128| slowlog-max-len 1000|" ./redis.conf \
  • 验证修改配置
cat ${REDIS_HOME}/redis.conf | grep -E "^[^;#]"

4.2.8 Redis使用目录赋权

# 日志目录赋权
chown -R redis:redis /var/log/redis
# 程序目录赋权
chown -R redis:redis /usr/local/redis
# pid文件目录赋权
chown -R redis:redis /var/run/redis
# 数据目录赋权(如果单独指定了数据目录),与配置文件中rdb存储路径一致
#chown -R redis:redis /data/redis/
chown -R redis:redis /var/log/redis \
&& chown -R redis:redis /var/run/redis \
&& chown -R redis:redis ${REDIS_HOME} \

4.2.9 启动Redis验证

  • 使用普通用户启动Redis
 sudo -u redis /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf 
  • Redis已经监听6379端口
root@Virtual-Machine-203:~# netstat -ntlp| grep redis
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      19821/redis-server  
tcp6       0      0 ::1:6379                :::*                    LISTEN      19821/redis-server  
root@Virtual-Machine-203:~# redis-cli 
127.0.0.1:6379> auth yourpassword
OK
127.0.0.1:6379> select 0
OK
127.0.0.1:6379> dbsize
(integer) 0
127.0.0.1:6379> kkconfig get save
1) "save"
2) "3600 1 900 500 60 10000"
127.0.0.1:6379> 

4.2.10 目录结构

  1. Redis安装目录
  • ${REDIS_HOME} = /etc/usr/redis7.2.5
    • bin 程序目录,已添加到系统环境变量PATH中
    • dump_port.rdb 持久化rdb文件,每个对应一个节点
    • redis.conf 单例服务配置文件
[root@localhost redis7.2.5]# tree
.
├── bin
│   ├── redis-benchmark
│   ├── redis-check-aof -> redis-server
│   ├── redis-check-rdb -> redis-server
│   ├── redis-cli
│   ├── redis-sentinel -> redis-server
│   └── redis-server
├── dump_6379.rdb
└── redis.conf
  1. Redis日志目录
  • /var/log/redis
    • 每个Redis服务实例对应一个日志文件
[root@localhost redis]# tree
.
└── redis_6379.log
  1. Redis PID目录
  • /var/run/redis
    • 每个Redis服务实例对应一个PID文件
[root@localhost redis]# tree
.
└── redis_6379.pid

4.3 配置systemd管理

4.3.1 编译安装时未使用systemd

非正规做法!正常应该编译时指定使用systemd
https://github.com/redis/redis/commit/129d14e1431e913426485526663e1a9aac67838c

在这里插入图片描述

vim /etc/systemd/system/redis-server.service
# example systemd service unit file for redis-server
#
# In order to use this as a template for providing a redis service in your
# environment, _at the very least_ make sure to adapt the redis configuration
# file you intend to use as needed (make sure to set "supervised systemd"), and
# to set sane TimeoutStartSec and TimeoutStopSec property values in the unit's
# "[Service]" section to fit your needs.
#
# Some properties, such as User= and Group=, are highly desirable for virtually
# all deployments of redis, but cannot be provided in a manner that fits all
# expectable environments. Some of these properties have been commented out in
# this example service unit file, but you are highly encouraged to set them to
# fit your needs.
#
# Please refer to systemd.unit(5), systemd.service(5), and systemd.exec(5) for
# more information.

[Unit]
Description=Redis data structure server
Documentation=https://redis.io/documentation
#Before=your_application.service another_example_application.service
#AssertPathExists=/var/lib/redis
Wants=network-online.target
After=network-online.target

[Service]
# 配置正确的服务和配置文件路径
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf --supervised systemd --daemonize no
## Alternatively, have redis-server load a configuration file:
#ExecStart=/usr/local/bin/redis-server /path/to/your/redis.conf
ExecStop=/bin/kill -s TERM $MAINPID
LimitNOFILE=65535
NoNewPrivileges=yes
#OOMScoreAdjust=-900
PrivateTmp=yes
#Type=notify  # 默认 simple
TimeoutStartSec=infinity
TimeoutStopSec=infinity
UMask=0077
User=redis
Group=redis
WorkingDirectory=/usr/local/redis

[Install]
WantedBy=multi-user.target
  • 替换配置文件中Redis路径
    如果使用默认路径/usr/local/redis,不用执行
# sed -i "s|/usr/local/redis|${REDIS_HOME}|g" /etc/systemd/system/redis-server.service 

4.3.2 编译安装时使用了systemd方式

vim /etc/systemd/system/redis-server.service
# example systemd service unit file for redis-server
#
# In order to use this as a template for providing a redis service in your
# environment, _at the very least_ make sure to adapt the redis configuration
# file you intend to use as needed (make sure to set "supervised systemd"), and
# to set sane TimeoutStartSec and TimeoutStopSec property values in the unit's
# "[Service]" section to fit your needs.
#
# Some properties, such as User= and Group=, are highly desirable for virtually
# all deployments of redis, but cannot be provided in a manner that fits all
# expectable environments. Some of these properties have been commented out in
# this example service unit file, but you are highly encouraged to set them to
# fit your needs.
#
# Please refer to systemd.unit(5), systemd.service(5), and systemd.exec(5) for
# more information.

[Unit]
Description=Redis data structure server
Documentation=https://redis.io/documentation
#Before=your_application.service another_example_application.service
#AssertPathExists=/var/lib/redis
Wants=network-online.target
After=network-online.target

[Service]
# 配置正确的服务和配置文件路径
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf --supervised systemd --daemonize no
## Alternatively, have redis-server load a configuration file:
#ExecStart=/usr/local/bin/redis-server /path/to/your/redis.conf
LimitNOFILE=65535
NoNewPrivileges=yes
#OOMScoreAdjust=-900
PrivateTmp=yes
Type=notify
#TimeoutStartSec=infinity
#TimeoutStopSec=infinity
TimeoutStartSec=180
TimeoutStopSec=180
UMask=0077
User=redis
Group=redis
WorkingDirectory=/usr/local/redis

[Install]
WantedBy=multi-user.target
  • 替换配置文件中Redis路径
    如果使用默认路径/usr/local/redis,不用执行
# sed -i "s|/usr/local/redis|${REDIS_HOME}|g" /etc/systemd/system/redis-server.service 

4.3.3 加载并验证服务

  • 加载systemd配置文件,每次修改后都需要重新加载
systemctl daemon-reload
  • 验证服务启动
# 启动
systemctl start redis-server
# 查看进程
netstat -ntlp | grep redis
  • 验证服务重启
# 测试重启
systemctl restart redis-server
# 查看进程ID是否变更
netstat -ntlp | grep redis
  • 验证服务停止
# 测试重启
systemctl stop redis-server
# 查看进程ID是否变更
netstat -ntlp | grep redis

4.3 部署常见问题

4.3.1 编译时环境问题

  • 现象:Ubuntu 没装 GCC
make[1]: Entering directory '/root/redis-7.2.5/src'
sh: 1: cc: not found
/bin/sh: 1: pkg-config: not found
/bin/sh: 1: pkg-config: not found
/bin/sh: 1: pkg-config: not found
    CC Makefile.dep
sh: 1: cc: not found
  • 处理:Ubuntu 22.04 安装
apt install build-essential pkg-config -y
  • 处理:如果是CentOS 7.9,参考安装
yum install make automake gcc gcc-c++ kernel-devel -y

4.3.2 编译时缺少文件

  • 现象:编译时缺文件
/usr/bin/ld: cannot find ../deps/hiredis/libhiredis.a: No such file or directory
/usr/bin/ld: cannot find ../deps/lua/src/liblua.a: No such file or directory
/usr/bin/ld: cannot find ../deps/hdr_histogram/libhdrhistogram.a: No such file or directory
/usr/bin/ld: cannot find ../deps/fpconv/libfpconv.a: No such file or directory
/usr/bin/ld: cannot find ../deps/jemalloc/lib/libjemalloc.a: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:403: redis-server] Error 1
make[1]: Leaving directory '/root/redis-7.2.5/src'
make: *** [Makefile:9: install] Error 2
  • 处理:先编译缺少的文件
root@Virtual-Machine-203:~# cd deps/
root@Virtual-Machine-203:~# make hiredis lua hdr_histogram fpconv jemalloc linenoise

# 如果jemalloc仍然不行,可以试试以下方式
#root@Virtual-Machine-203:~# cd  deps/jemalloc/
#root@Virtual-Machine-203:~#  ./configure
#root@Virtual-Machine-203:~#  make && make install_bin install_include install_lib

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

2025天津数控机床展(天津工业展)

2025第21届天津工博会—机床展 时间&#xff1a;2025年3月6-9日 地点&#xff1a;国家会展中心&#xff08;天津&#xff09; 达成交易&#xff0c;是我们唯一的追求&#xff01; Dealing Is Our Top Pursuit. 主办单位 振威会展集团 中国机械工业联合会 中国国际贸易促…

名称申请不了商标,可以受保护不!

前几天个网友说要申请注册个商标名称&#xff0c;发来名称让普推商标知产老杨帮忙检索了下&#xff0c;发现有同名的被驳回&#xff0c;而且是做过驳回复审被驳回&#xff0c;而且是绝对理由驳回的&#xff0c;易使消费者对商品的品质等特点产生误认&#xff0c;不得作为商标使…

如何开发一个项目脚手架cli

目录 背景正文unbuildpromptsprogresskolorist 设置打包命令npm execnpxnpm init/ npm create/ npm innit 使用最后 背景 随着团队项目类型越来越多&#xff0c;方便后续快速去开发项目&#xff0c;会出现各种类型的项目模版项目。 这样开发只需要通过脚手架选择自己需要的项目…

数据采集之二主一从,485总线共享器

产品概述 485总线共享器示意图 功能示意图 DAQ-GP-485HUB是上海数采物联网推出的一款 RS485总线多路复用共享数据处理器&#xff0c;是一款高性能的通讯设备&#xff0c;专门针对两台主机和 一台从机通讯时导致的数据冲突而设计。在实际工业控制和监控场景中&#xff0c;多个主…

Java宝藏实验资源库(3)类

一、实验目的 理解面向对象程序的基本概念。掌握类的继承的实现机制。熟悉类中成员的访问控制方法。熟悉ArrayList类的使用。 二、实验内容、过程及结果 *9.5Programming Exerc ise the GregorianCal endar class) Java API has the GregorianCalendar class in the java. uti…

算法008:四数之合

四数之和. - 备战技术面试&#xff1f;力扣提供海量技术面试资源&#xff0c;帮助你高效提升编程技能,轻松拿下世界 IT 名企 Dream Offer。https://leetcode.cn/problems/4sum/description/ 在前面的两个题中&#xff0c;我们已经完成了两数之和和三数之和&#xff0c;到本题四…

基于51单片机的函数信号发生器

基于51单片机函数信号发生器 &#xff08;仿真&#xff0b;程序&#xff0b;原理图&#xff0b;设计报告&#xff09; 功能介绍 具体功能&#xff1a; 1.LCD1602液晶显示波形种类和频率值&#xff08;10-100HZ&#xff09;&#xff1b; 2.按键设置波形种类和设定频率步进值…

Notepad++插件 Hex-Edit

Nptepad有个Hex文件查看器&#xff0c;苦于每次打开文件需要手动开插件显示Hex&#xff0c;配置一下插件便可实现打开即调用 关联多个二进制文件&#xff0c;一打开就使用插件的方法&#xff0c;原来是使用空格分割&#xff01;&#xff01;&#xff01;

螺蛳粉店外卖配送小程序商城的效果为何

螺蛳粉是广西地区的特色美食&#xff0c;在当地有着大量实体餐饮店或品牌商&#xff0c;其单品消费率非常高&#xff0c;在外地也不乏自创品牌或加盟店等&#xff0c;其特殊的味道及吸引力也同样复购率高&#xff0c;客户除了线下到店外&#xff0c;也会购买袋/桶装螺蛳粉到家自…

【无线感知】【P4】无线感知手势识别- WIFI 感知边界

前言&#xff1a; 这篇是北大2022 在Ubicomp 上面的论文 《placement Matters&#xff1a; understanding the Effects of Device placements for WiFi Sensing》 放置很重要&#xff1a;了解设备放置对WiFi传感的影响 目录&#xff1a; 简介 感知质量定义&#xff08;SSNR…

Bayanay:一款基于Python开发的无线网络安全研究工具

关于Bayanay Bayanay是一款基于纯Python开发的无线网络安全研究工具&#xff0c;在该工具的帮助下&#xff0c;无论你身处何地&#xff0c;都可以轻松地对周围地区的无线网络安全状况进行研究与分析。 该工具可以通过使用HTML5的地理位置定位功能并结合Scapy获取到的SSID信息…

Flutter ffi Failed to lookup symbol

iOS release版本&#xff0c;解决方式参考官方文档&#xff1a;在 iOS 中使用 dart:ffi 调用本地代码 如果debug版本也报这个错误&#xff0c;很可能是有多个.c文件&#xff0c;编译的时候没带上&#xff01; 假设你的ffi模块名字是 c_lib 对于Android端&#xff0c;需要修改…

Node.js中基于node-schedule实现定时任务之详解

文章目录 一、定时任务二、node-schedule、1、安装2、引入3、基于Cron表达式的规则4、基于Date的规则5、基于RecurrenceRule的规则6、API7、状态监听 一、定时任务 实际工作中&#xff0c;可能会遇到定时清除某个文件夹内容&#xff0c;定时发送消息或发送邮件给指定用户&…

Codepen Three.js环境依赖配置

Codepen Three.js环境依赖配置 前言 如果想在CodePen环境写Three.js依赖的项目&#xff0c;环境搭建可以参考该Codepen项目: Chill the lion 详细 打开设置可以看到以下配置 更多项目参考 1. Chill the Lion Chill the Lion 是一个基于 ThreeJS 制作的 WebGL 示例。它由…

FreeRTOS学习 -- 时间管理

在使用 FreeRTOS 的过程中通常会在一个任务函数中使用延时函数对这个任务延时&#xff0c;当执行延时函数的时候会进行任务切换&#xff0c;并且此任务就会进入阻塞态&#xff0c;直到延时完成&#xff0c;任务重新进入就绪态。 FreeRTOS 延时函数 1、函数 vTaskDelay() 在F…

【全开源】沃德会务会议管理系统(FastAdmin+ThinkPHP+Uniapp)

沃德会务会议管理系统一款基于FastAdminThinkPHPUniapp开发的会议管理系统&#xff0c;对会议流程、开支、数量、标准、供应商提供一种标准化的管理方法。以达到量化成本节约&#xff0c;风险缓解和服务质量提升的目的。适用于大型论坛、峰会、学术会议、政府大会、合作伙伴大会…

简单了解MyBatis

MyBatis 1、快速入门 MyBatis中文手册官网MyBatis中文网 1.1、创建数据表添加数据 create table user(id int auto_increment primary key comment 主键id,name varchar(20) comment 姓名,age int comment 年龄,gender char(1) comment 性别&#xff08;1&#xff1a;男, 2…

为什么我在 PostgreSQL 中 Commit 很慢?

有时&#xff0c;我们的一位客户会查看数据库中最耗时的语句&#xff08;使用pg_stat_statements或pgBadger&#xff09;&#xff0c;并发现COMMIT排名靠前。通常&#xff0c;COMMIT这是 PostgreSQL 中非常快的语句&#xff0c;因此值得研究。在本文中&#xff0c;我将探讨速度…

四川赤橙宏海商务信息咨询有限公司可信吗?

在数字化浪潮席卷全球的今天&#xff0c;电商行业正以前所未有的速度蓬勃发展。作为这一领域的佼佼者&#xff0c;四川赤橙宏海商务信息咨询有限公司凭借其在抖音电商服务领域的深厚积累和卓越表现&#xff0c;成为了引领行业创新发展的重要力量。 四川赤橙宏海商务信息咨询有…

华为设备telnet 远程访问配置实验简述

一、实验需求: 1、AR1模拟电脑telnet 访问AR2路由器。 二、实验步骤&#xff1a; 1、AR1和AR2接口配置IP&#xff0c;实现链路通信。 2、AR2配置AAA模式 配置用户及密码 配置用户访问级别 配置用户telnet 访问服务 AR2配置远程服务数量 配置用户远程访问模式为AAA 配置允许登录…