相关连接:通过Canal保证某网站的Redis与MySql的数据自动同步


1.错误信息

redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value

2.分析

当前程序中key的操作类型,并不与redis库中存在的key的类型相匹配。举例

第一次保存key,将其设置为key-value形式

[root@server3 src]# ./redis-cli -h 192.168.6.123 -p 6379 -a "{password}"
192.168.6.123:6379> set my_test_userid_001 "0001"
OK
192.168.6.123:6379> get my_test_userid_001
"0001"

第二次保存key,将其以key-map形式进行保存,则会报错

192.168.6.123:6379> hmset my_test_userid_001 user001 "0001" user002 "0002"
(error) WRONGTYPE Operation against a key holding the wrong kind of value

如果删除之前的key,则当前的操作可以进行:

192.168.6.123:6379> del my_test_userid_001
(integer) 1
192.168.6.123:6379> hmset my_test_userid_001 user001 "0001" user002 "0002"
OK
192.168.6.123:6379> hgetall my_test_userid_001
1) "user001"
2) "0001"
3) "user002"
4) "0002"
192.168.6.123:6379> hmget my_test_userid_001 user001
1) "0001"
192.168.6.123:6379> del my_test_userid_001
(integer) 1

3.问题解决

3.1.临时解决

删除冲突key,类似于:

192.168.6.123:6379> del my_test_userid_001

3.2.根本解决

造成这个问题,肯定是程序在多处使用了同一个key,并且是以不同的类型,有的以key-value类型,有的以key-map,有的以key-object。

查看程序,找到这个冲突,并修改。

原文地址:https://blog.csdn.net/hanchao5272/article/details/79051364

最新文章

  1. 3.Windows Server 2012 R2数据库部署
  2. 手把手教你在Ubuntu上安装Apache、MySql和PHP
  3. IPv4头部结构
  4. (转)清理AIX的/var文件系统大小
  5. 用C#打开文件对话框的方法和简单使用的程序
  6. git添加标签(转载)
  7. C#正则表达式判断字符串是否是金钱
  8. zzzzw_在线考试系统③完结篇
  9. 快速傅里叶变换应用之二 hdu 4609 3-idiots
  10. html name id, 与服务器交互必须有name
  11. Microsoft Push Notification Service(MPNS)的最佳体验
  12. Eclipse和debug的一些快捷键
  13. tomcat服务器一闪而过解决方法
  14. zipkin
  15. 使用jprofiler分析dump文件一个实例
  16. Window系统下搭建GIT本地服务器
  17. 一个ip对应多个域名多个ssl证书配置-Nginx实现多域名证书HTTPS
  18. Linux - 账户切换授权
  19. Collections.synchronizedMap()与ConcurrentHashMap的区别
  20. S老师 破坏神学习

热门文章

  1. Leetcode5.Longest Palindromic Substring最长回文字串
  2. JavaScript--阻止事件冒泡stopPropagation和cancelBubble
  3. 深入理解 Node.js 进程与线程
  4. sas信用评分之第二步变量筛选
  5. Directx11教程36 纹理映射(6)
  6. weixin 微信开放平台 微信公众平台
  7. OpenJudge_1936:All in All
  8. redux之createStore方法底层封装模拟
  9. Python里的迭代器
  10. 2018-2-13-WPF-只允许打开一个实例