04 2021 档案

摘要:1.允许以root用户登录操作系统 默认情况下debian是不允许以root用户登录的,只能以其他用户登录系统中,然后su到root用户下进行操作。 1vim /etc/gdm3/daemon.conf 新增下面一行AllowRoot = true [security] AllowRoot = tr 阅读全文
posted @ 2021-04-21 10:35 linuxTang 阅读(354) 评论(0) 推荐(0) 编辑
摘要:1测试准备 [root@db04 ~]# vim mytxt.log #创建一个大文件 [root@db04 ~]# redis-server /opt/redis_cluster/redis_6379/conf/redis_6379.conf #启动redis [root@db04 ~]# red 阅读全文
posted @ 2021-04-19 15:17 linuxTang 阅读(222) 评论(0) 推荐(0) 编辑
摘要:1启动所有节点redis [root@db03 ~]# sh redis_shell.sh start 6380 [root@db03 ~]# sh redis_shell.sh start 6381 [root@db03 ~]# ps -ef|grep redis 2安装工具: [root@db0 阅读全文
posted @ 2021-04-18 14:13 linuxTang 阅读(119) 评论(0) 推荐(0) 编辑
摘要:一,完整的重新做一个redis集群 1 [root@db01 ~]# pkill redis #停掉所有节点的redis [root@db01 ~]# rm -rf /data/redis_cluster/redis_6380/* #删除所有节点数据 [root@db01 ~]# rm -rf /d 阅读全文
posted @ 2021-04-15 18:09 linuxTang 阅读(154) 评论(0) 推荐(0) 编辑
摘要:一,在db01中新增加一个节点 1创建配置文件日志文件和pid文件的存放目录,创建redis数据的存放目录: [root@db01 ~]# mkdir -p /opt/redis_cluster/redis_{6390,6391}/{conf,logs,pid} [root@db01 ~]# mkd 阅读全文
posted @ 2021-04-14 18:11 linuxTang 阅读(109) 评论(0) 推荐(0) 编辑
摘要:一利用工具搭建redis集群 0前提条件: 执行下列步骤的前提是已经安装了redis,配置了服务器之间的互信以及添加了域名解析参考网址:https://www.cnblogs.com/tyjs09/p/14601241.html 1安装redis支持的插件(不指定版本会给你安装最旧的): [root 阅读全文
posted @ 2021-04-14 18:02 linuxTang 阅读(196) 评论(0) 推荐(0) 编辑
摘要:1安装redis(本例已安装可忽略) [root@db01 ~]# yum makecache fast [root@db01 ~]# yum install rubygems [root@db01 ~]# gem sources --remove https://rubygems.org/ [ro 阅读全文
posted @ 2021-04-13 18:08 linuxTang 阅读(103) 评论(0) 推荐(0) 编辑
摘要:一高可用配置: 1把集群信息保存到txt文档里以作备用: [root@db01 ~]# sh redis_shell.sh login 6380 10.0.0.201:6380> cluster nodes 4c007a5e2d894aa4c6ce950467221f01fd50f645 10.0. 阅读全文
posted @ 2021-04-13 16:53 linuxTang 阅读(189) 评论(0) 推荐(0) 编辑
摘要:1先获取所有主节点信息 [root@db03 ~]# redis-cli -c -h db01 -p 6381 cluster nodes #先查看节点信息并保存 ddee11b9c4c6622bbf28497c53aa1eb84846084f 10.0.0.203:6381 slave 4c007 阅读全文
posted @ 2021-04-13 16:36 linuxTang 阅读(660) 评论(0) 推荐(0) 编辑
摘要:一准备: 在db01中操作: [root@db01 ~]# mkdir -p /opt/redis_cluster/redis_{6380,6381}/{conf,logs,pid} [root@db01 ~]# mkdir –p /data/redis_cluster/redis_{6380,63 阅读全文
posted @ 2021-04-12 18:26 linuxTang 阅读(85) 评论(0) 推荐(0) 编辑
摘要:1主redis宕掉后,发现db02自动变为主库: [root@db01 ~]# pkill redis [root@db01 ~]# redis-cli -h db03 -p 6379 set k1 v1 (error) READONLY You can't write against a read 阅读全文
posted @ 2021-04-10 10:40 linuxTang 阅读(417) 评论(0) 推荐(0) 编辑
摘要:1停掉所有主从redis,然后删除从里面免密钥登录文件 127.0.0.1:6379> shutdown not connected> [root@db03 ~]# cd /root/.ssh/ [root@db03 .ssh]# ls id_rsa.pub [root@db03 .ssh]# rm 阅读全文
posted @ 2021-04-10 09:24 linuxTang 阅读(1013) 评论(0) 推荐(0) 编辑
摘要:一准备2台装有redis的机器(在所有节点都操作): 1#杀掉redis:pkill redis 2#清空数据:rm -rf /data/redis_cluster/redis_6379/* 3#编写配置文件 ### 以守护进程模式启动 daemonize yes ### 绑定的主机地址 bind 阅读全文
posted @ 2021-04-07 17:05 linuxTang 阅读(387) 评论(0) 推荐(0) 编辑
摘要:一,给db01和db02两台机器建立互信: 1在db01机器中生成公匙并将公匙传送给db02: [root@db01 ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save t 阅读全文
posted @ 2021-04-07 15:31 linuxTang 阅读(99) 评论(0) 推荐(0) 编辑
摘要:1配置文件中设置长期密码 [root@db01 ~]# vim /opt/redis_cluster/redis_6379/conf/redis_6379.conf ### 以守护进程模式启动 daemonize yes ### 绑定的主机地址 bind 10.0.0.201 127.0.0.1 # 阅读全文
posted @ 2021-04-06 13:57 linuxTang 阅读(101) 评论(0) 推荐(0) 编辑
摘要:1编写配置文件(红字) [root@db01 ~]# vim /opt/redis_cluster/redis_6379/conf/redis_6379.conf ### 以守护进程模式启动 daemonize yes ### 绑定的主机地址 bind 10.0.0.201 127.0.0.1 ## 阅读全文
posted @ 2021-04-02 17:24 linuxTang 阅读(60) 评论(0) 推荐(0) 编辑
摘要:1持久化只需要在配置文件中添加如下3行红字,只要满足一个条件,就可以保存数据 [root@db01 ~]# vim /opt/redis_cluster/redis_6379/conf/redis_6379.conf ### 以守护进程模式启动 daemonize yes ### 绑定的主机地址 b 阅读全文
posted @ 2021-04-02 17:16 linuxTang 阅读(56) 评论(0) 推荐(0) 编辑
摘要:1redis可作为mysql的缓存使用,这个映射关系就可以用hash哈希值处理,例如mysql中select * from user where id=1000这个语句表示要查询id=1000的用户的所有信息,在redis中就可以用hgetall user:1000来表示: 127.0.0.1:63 阅读全文
posted @ 2021-04-01 16:56 linuxTang 阅读(128) 评论(0) 推荐(0) 编辑
摘要:1差集: 127.0.0.1:6379> sadd set1 1 2 5 8 9 #添加第一个集合 (integer) 5 127.0.0.1:6379> smembers set1 #查看集合内容 1) "1" 2) "2" 3) "5" 4) "8" 5) "9" 127.0.0.1:6379> 阅读全文
posted @ 2021-04-01 16:55 linuxTang 阅读(38) 评论(0) 推荐(0) 编辑
摘要:一字符串 set:设置指定key的值,例如set zhangsan 28 get:获取指定key的值,例如get zhangsan mset:设置多个key-value值,例如mset k1 v1 k2 v2 k3 v3 mget:获取所有给定的key值 incr key:将key存储的数字增加1, 阅读全文
posted @ 2021-04-01 11:03 linuxTang 阅读(93) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示