当前位置: 首页 > news >正文

网站建设督查工作主持词网推软件有哪些

网站建设督查工作主持词,网推软件有哪些,网站logo设计教程,网页微博怎么看直播1 安装: 1.1 生产环境安装 注意: 1、如果安装过程有问题可以参考源代码中的 README.md 文件 2、如果服务器只安装一个 redis 通常选择 /usr/local/redis 作为安装目录,如果安装多台则建议带上 服务名称 区分(建议带上 服务名称 区…

1 安装:

1.1 生产环境安装

注意:

1、如果安装过程有问题可以参考源代码中的 README.md 文件

2、如果服务器只安装一个 redis 通常选择 /usr/local/redis 作为安装目录,如果安装多台则建议带上 服务名称 区分(建议带上 服务名称 区分)。以下将以版本号作为区分安装在 /usr/local/redis-6.2.5 目录

1、下载、解压

cd /usr/local/src
wget https://download.redis.io/releases/redis-6.2.5.tar.gz
tar -xzf redis-6.2.5.tar.gz
cd redis-6.2.5

2、编译

make

3、Redis 安装在指定的目录(该命令在readme文件中提示)

make PREFIX=/usr/local/redis-6.2.5 install

4、启动先测试下

# 启动
./bin/redis-server redis.conf

5、启动没问题后,复制配置文件到安装目录(后续步骤是可选的,根据需要执行)

cd /usr/local/redis-6.2.5
mkdir conf
# 拷贝配置文件(6379.conf是要使用的配置文件)
cp /usr/local/src/redis-6.2.5/redis.conf conf
cp /usr/local/src/redis-6.2.5/redis.conf redis.conf.back
cp /usr/local/src/redis-6.2.5/redis.conf 6379.conf

6、修改配置允许远程访问

  • 注释掉 bind 配置

  • 关闭保护模式,把 protected-mode 设置为 no

  • 关闭防火墙

  • 可以设置密码,属性是 requirepass

    建议开发阶段不要设置,有如下原因:

    1、麻烦

    2、后面的开机启动脚本在设置密码情况下不能完成 redis 的关闭因为要认证,可以使用 kill 命令强制杀死进程但暂时不想去修改脚本

7、官网对配置文件的修改有一些建议,我们针对建议和自己情况做如下修改

# redis 的数据目录
mkdir /var/redis
mkdir /var/redis/6379# 编辑启动脚本
vim /etc/init.d/redis_6379

关于配置文件的建议及其代码如下:

  • Set daemonize to yes (by default it is set to no)
  • Set the pidfile to /var/run/redis_6379.pid (modify the port if needed)
  • Set the logfile to /var/log/redis_6379.log
  • Set the dir to /var/redis/6379 (very important step!)
daemonize yes
pidfile /var/run/redis_6379.pid
logfile /var/log/redis_6379.log
dir /var/redis/6379

7、修改启动脚本

修改启动脚本文件前面的环境变量

# 复制开机启动脚本
cp /usr/local/src/redis-6.2.5/utils/redis_init_script /etc/init.d/redis_6379
# 编辑配置文件
vim /etc/init.d/redis_6379# 把配置文件开头的环境变量修改如下
REDISPORT=6379
EXEC=/usr/local/redis-6.2.5/bin/redis-server
CLIEXEC=/usr/local/redis-6.2.5/bin/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/usr/local/redis-6.2.5/conf/${REDISPORT}.conf"

测试下脚本是否正常

# 单独测试下启动和关闭脚本
/etc/init.d/redis_6379 start
/etc/init.d/redis_6379 stop

8、配置开机启动

启动脚本的文件头部已经写明了服务名称、启动级别、关闭级别,如下图所示:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-G9oSu663-1683652340855)(/Users/apple/Library/Application Support/typora-user-images/image-20230425234244627.png)]

所以下面我们直接执行 chkconfig 把配置添加到开机启动中

# 直接添加就可以了,因为已经指明了启动级别、关闭级别
chkconfig --add redis_6379

前面已经单独测试启动脚本是否正常,此处可不必重启测试

# 重启
reboot
ps -ef | grep redis

1.2 Docker 安装 Redis(开发测试使用不要太爽)

docker pull redis
docker run -d --name redis-test -p 6379:6379 redis

2 Redis 可视化工具

本文推荐一款工具Redis Insight,下载的地址是:https://redislabs.com/redisinsight/

推荐理由:好用,且官方推荐!

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qpIqeEDD-1683652340856)(/Users/apple/Library/Application Support/typora-user-images/image-20230426012724754.png)]

其他多种可用工具参考:https://blog.csdn.net/m0_67645544/article/details/125209547

3 数据类型

官方参考

# 各种数据类型总览(含总览和详细命令参考)
https://redis.io/docs/data-types/# 官方数据类型教程
https://redis.io/docs/data-types/tutorial/# 在线尝试及人门教程
https://try.redis.io/

3.1 Redis全局命令(跟key有关系,而跟value无关)

  • Keys pattern

  • Exists key

  • del key

  • Expire key second

  • Ttl key

  • Type key

3.2 Strings

Getting and setting Strings

  • SET stores a string value

  • GET retrieves a string value

  • SETNX stores a string value only if the key doesn’t already exist. Useful for implementing locks

    对于实现锁很有用

  • MGET retrieves multiple string values in a single operation

Managing counters

  • INCRBY atomically increments (and decrements when passing a negative number) counters stored at a given key

    为什么要有 INCR 等这些命令,因为它们是原子的

    举例:

    > INCR views:page:2
    (integer) 1
    > INCRBY views:page:2 10
    (integer) 11
    

3.3 Lists(L)

redis 的 list 用的是链表结构!

用途:

1、记住最新的更新(如网络上的最近10条数据)

记住最新的记录(如lpush和ltrim和lrange的配合可以获取最新的记录,ltrim会删除范围外的其他数据只保留范围内的最新记录)

2、2个进程的交流(如生产者消费者)

Basic commands

  • LPUSH adds a new element to the head of a list; RPUSH adds to the tail
  • LPOP removes and returns an element from the head of a list; RPOP does the same but from the tails of a list
  • LLEN returns the length of a list
  • LMOVE atomically moves elements from one list to another
  • LTRIM reduces a list to the specified range of elements

Blocking commands

常用于生产者消费者模式???

支持不同的阻塞命令

  • BLPOP removes and returns an element from the head of a list. If the list is empty, the command blocks until an element becomes available or until the specified timeout is reached

    要么阻塞要么超时

3.4 Sets(S)

唯一,但是无序

Basic commands

  • SADD adds a new member to a set

  • SREM removes the specified member from the set

  • SISMEMBER tests a string for set membership

  • SINTER returns the set of members that two or more sets have in common (i.e., the intersection)

    交集:sinter

    差集:sdiff

    并集:sunion

  • SCARD returns the size (a.k.a. cardinality) of a set

3.5 Hashes(H)

非常适合代表“对象”、效率非常高效

Basic commands

  • HSET sets the value of one or more fields on a hash
  • HGET returns the value at a given field
  • HMGET returns the values at one or more given fields
  • HINCRBY increments the value at a given field by the integer provided

3.6 Sorted sets(Z)

既有 set 的特征(key不重复)也有 hash 的特征(score,一个key对应一个分数)

基本同set,但是有一个分数;所以非常适合用于获取范围的元素,例如:前10,最后10个

Basic commands

  • ZADD adds a new member and associated score to a sorted set. If the member already exists, the score is updated

  • ZRANGE returns members of a sorted set, sorted within a given range

  • ZRANK returns the rank of the provided member, assuming the sorted is in ascending order

    排名:获取前多少的元素

  • ZREVRANK returns the rank of the provided member, assuming the sorted set is in descending order

3.7 Bitmaps

是 String 数据类型的拓展,可以对象 string 像一个 bit 的向量;因为只能设置 0 和 1,所以适合是否判断的情况

1、操作上分为两组:设置获取值和对组的统计(统计值)

2、判断是否时,提供极大的空间节省(比如配合自增长id,就可以使用512M的空间判断4亿人是否在位图中)

Basic commands

  • SETBIT sets a bit at the provided offset to 0 or 1

  • GETBIT returns the value of a bit at a given offset

  • BITOP lets you perform bitwise operations against one or more strings

    备注:位操作

3.8 HyperLogLog(pf开头,发明算法的人的简写)

是一个概率性的数据结构,用来估算一个 set 的基数(基数就是不重复元素),是一种概率算法存在一定的误差,占用内存只有12kb但是非常适合超大数据量的统计,比如网站访客的统计

Basic commands

  • PFADD adds an item to a HyperLogLog

  • PFCOUNT returns an estimate of the number of items in the set

    返回基数的估算值

  • PFMERGE combines two or more HyperLogLogs into one

3.9 Geospatial(Geo)

地理位置坐标,即经纬度

Basic commands

  • geoadd:添加地理位置的坐标

  • geopos:获取地理位置的坐标

  • geodist:计算两个位置之间的距离

  • georadius:根据用户给定的经纬度坐标来获取指定范围内的地理位置集合

    以某个点为中心,半径多少的范围

  • geohash:返回一个或多个位置对象的 geohash 值

    备注:

    1、返回 hash 值是为了不丢失精度

    2、可以根据返回的 hash 值反向计算出经纬度

4 Redis 的持久化方案

4.1 Rdb 方式

Redis 默认的方式,redis 通过快照方式将数据持久化到磁盘中

为什么叫做 rdb,因为是 Redis Database 的缩写

设置持久化快照的条件

在 redis.conf 中修改持久化快照的条件:

持久化文件的存储目录

在 redis.conf 中可以指定持久化文件的存储目录

备注:dbfilename 是 Redis Database Filename 的缩写

Rdb 的问题

一旦 redis 非法关闭,那么会丢失最后一次持久化之后的数据

如果数据不重要,则不必要关心。 如果数据不能允许丢失,那么要使用 aof 方式

因为 save 是间隔性触发的

4.2 Aof 方式

Redis 默认是不使用该方式持久化的。Aof 方式的持久化,是操作一次 redis 数据库,则将操作的记录存储到 aof 持久化文件中

  • 第一步:开启 aof 方式持久化方案。 将 redis.conf 中的 appendonly 改为 yes,即开启 aof 方式的持久化方案

  • aof 文件存储的目录和 rdb 方式的一样。 aof 文件存储的名称

在使用 aof 和 rdb 方式时,如果 redis 重启,则数据从 aof 文件加载

5 应用

案例 1:生成一个 6 为数字的验证码,每天只能发送 3 次,5 分钟内有效

1、生成 6 个数字验证码(randon类)

2、计数的工具(redis的incr。 并且设计过期时间为24 * 60 * 60秒)

3、吧生成的验证码放入 redis 中

步骤:

1、校验是否满足次数要求

2、生成验证码放入 redis,并修改次数

3、对用户提交的验证码做

6 相关资源

Redis 官网:https://redis.io/

源码地址:https://github.com/redis/redis

Redis 在线测试:http://try.redis.io/

Redis 命令参考:http://doc.redisfans.com/、https://redis.io/commands/(把命令按类 group 进行了分组)

获取 Redis 命令帮助:

1、直接用命令行获取参数的帮助

2、在官方文档的命令帮助中可按组(group)或命令(command)直接查询

传送门:保姆式Spring5源码解析

欢迎与作者一起交流技术和工作生活

联系作者


文章转载自:
http://ludic.dtrz.cn
http://saltation.dtrz.cn
http://whame.dtrz.cn
http://realism.dtrz.cn
http://wolver.dtrz.cn
http://fingertip.dtrz.cn
http://seismometry.dtrz.cn
http://paganize.dtrz.cn
http://divorce.dtrz.cn
http://naples.dtrz.cn
http://dogvane.dtrz.cn
http://spend.dtrz.cn
http://austronesia.dtrz.cn
http://senhorita.dtrz.cn
http://prevarication.dtrz.cn
http://pig.dtrz.cn
http://scape.dtrz.cn
http://lackwit.dtrz.cn
http://soaring.dtrz.cn
http://dispersed.dtrz.cn
http://mesoscale.dtrz.cn
http://crossbeam.dtrz.cn
http://incongruity.dtrz.cn
http://heelball.dtrz.cn
http://heroon.dtrz.cn
http://arginase.dtrz.cn
http://shooter.dtrz.cn
http://bilirubin.dtrz.cn
http://unperceptive.dtrz.cn
http://parsimony.dtrz.cn
http://win95.dtrz.cn
http://spiroscope.dtrz.cn
http://disparaging.dtrz.cn
http://mandatory.dtrz.cn
http://striated.dtrz.cn
http://bacony.dtrz.cn
http://mellowness.dtrz.cn
http://erythrism.dtrz.cn
http://null.dtrz.cn
http://autolyze.dtrz.cn
http://antienzymatic.dtrz.cn
http://viol.dtrz.cn
http://swabia.dtrz.cn
http://liturgician.dtrz.cn
http://glaive.dtrz.cn
http://athanasia.dtrz.cn
http://homochrome.dtrz.cn
http://health.dtrz.cn
http://antediluvian.dtrz.cn
http://readapt.dtrz.cn
http://taffy.dtrz.cn
http://alloantibody.dtrz.cn
http://teratoid.dtrz.cn
http://greenlet.dtrz.cn
http://postfix.dtrz.cn
http://bocce.dtrz.cn
http://cornetist.dtrz.cn
http://lachrymal.dtrz.cn
http://heeltap.dtrz.cn
http://created.dtrz.cn
http://knucklejoint.dtrz.cn
http://vermont.dtrz.cn
http://mongline.dtrz.cn
http://secam.dtrz.cn
http://sis.dtrz.cn
http://formulary.dtrz.cn
http://caddish.dtrz.cn
http://seedsman.dtrz.cn
http://through.dtrz.cn
http://sucker.dtrz.cn
http://geometric.dtrz.cn
http://bosomy.dtrz.cn
http://polecat.dtrz.cn
http://gimel.dtrz.cn
http://debutant.dtrz.cn
http://semilogarithmic.dtrz.cn
http://unfounded.dtrz.cn
http://unsocial.dtrz.cn
http://breaststroke.dtrz.cn
http://crinoid.dtrz.cn
http://auriscopically.dtrz.cn
http://scrupulosity.dtrz.cn
http://glassblower.dtrz.cn
http://voiture.dtrz.cn
http://corrosible.dtrz.cn
http://cobbly.dtrz.cn
http://diapason.dtrz.cn
http://chancery.dtrz.cn
http://oxygenase.dtrz.cn
http://guttiferous.dtrz.cn
http://changeful.dtrz.cn
http://oar.dtrz.cn
http://familarity.dtrz.cn
http://malinois.dtrz.cn
http://potassium.dtrz.cn
http://superstrength.dtrz.cn
http://woolsorter.dtrz.cn
http://unsocial.dtrz.cn
http://carpospore.dtrz.cn
http://enrage.dtrz.cn
http://www.dt0577.cn/news/103886.html

相关文章:

  • 余姚有专业做网站的吗上海优化网站seo公司
  • 网站中英文转换js九幺seo工具
  • 怎么用链接进自己做的网站吗百度广告代理商加盟
  • 中国有色金属建设股份有限公司网站国际军事新闻最新消息今天
  • 万网是什么网站怎么做一个公司网站
  • wordpress tumblr贵州seo推广
  • 中国建设银行官方网站首页搜狗友链交换
  • 能赚钱的网站怎么做引流推广网站
  • 做网站知识点刚刚地震最新消息今天
  • 湖北省住房和城乡建设厅门户网站备案查询站长之家
  • wordpress取消邮件优化关键词的方法正确的是
  • 网站怎么做会被收录免费发布信息的平台
  • 网站关键词怎么选择谷歌浏览器官方app下载
  • 没有数据库的网站营销案例
  • 搜索引擎优化大致包含哪些内容或环节成都公司网站seo
  • 屏幕分辨率 网站开发公司搜索seo
  • 做任务赚钱的正规网站营销助手下载app下载
  • 做暖暖小视频免费网站网站综合查询工具
  • 常德网站建设详细策划短视频优化
  • 建站工作室 网站建设工作室成都网站建设方案托管
  • 自己做网站能赚钱吗东莞今日头条最新消息
  • 响应式网站什么意思下载app到手机上并安装
  • 做网站做小程序推广做百度线上推广
  • wordpress登录才可访问网站做seo教程
  • 郑州高新区做网站开发的公司seo名词解释
  • 做图软件ps下载网站有哪些成都seo排名
  • 即墨做网站网站生成
  • as.net 网站开发视频教程无锡seo公司
  • 企业在线购物网站建设百度智能建站系统
  • 管理系统平台seo搜索排名影响因素主要有