Tags : redis
发表时间:2017-12-19 21:41:51
Redis查看服务信息命令info的参数解释。
127.0.0.1:6379> info
Server 服务器参数
redis_version:3.2.11 # redis版本
redis_git_sha1:00000000 # Git SHA1
redis_git_dirty:0 # Git dirty flag
redis_build_id:20886e8636ba9141 # redis build id (这里三个不用理会,估计也就是git相关的校验和构建)
re
Tags : MySQL,调优,优化
发表时间:2017-10-26 21:54:31
MySQL是一个强大的开源数据库。随着MySQL上的应用越来越多,MySQL逐渐遇到了瓶颈。这里提供 101 条优化 MySQL 的建议。有些技巧适合特定的安装环境,但是思路是相通的。我已经将它们分成了几类以帮助你理解。
MySQL监控MySQL服务器硬件和OS(操作系统)调优:
1、有足够的物理内存,能将整个InnoDB文件加载到内存里 —— 如果访问的文件在内存里,而不是在磁盘上,InnoDB会快很多。
2、全力避免 Swap 操作 — 交换(swapping)是从磁盘读取数据,所以会
Tags : MySQL,批量插入
发表时间:2017-10-02 13:35:48
在日常MySQL操作中,数据迁移是经常要做的事情。
而且这就涉及到快速批量的数据迁移,也就是操作中需要进行批量插入或更新。
这里分享下我使用Spring JDBC进行批量插入的数据迁移学习案例。
destJdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
&n
Tags : mysql,递归查询
发表时间:2017-04-24 15:57:06
1、创建表:
DROP TABLE IF EXISTS `t_areainfo`; CREATE TABLE `t_areainfo` (
`id` int(11) NOT '0' AUTO_INCREMENT,
`level` int(11) DEFAULT '0',
`name` varchar(255) DEFAULT '0',
`parentId` int(11) DEFAULT '0',
`status` int(11) DEFAULT '0', PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO
Tags : redis
发表时间:2017-03-05 21:14:37
觉得作者·胡小海 这几个笔记做的真不错,所以汇总下,感谢作者哈。
1、Redis学习笔记(一) Redis安装与基本使用(windows)
2、Redis学习笔记(二) Redis持久化
3、Redis学习笔记(三) Redis主从架构和主从从架构 (1)
4、Redis学习笔记(四) Redis哨兵(sentinel)
5、 Redis学习笔记(五) 基于Redis 3.0的集群
Tags : Jedis,Redis
发表时间:2017-01-18 00:26:44
使用Jedis来调用redis时,获取连接出现如下:
Caused by: Java.util.NoSuchElementException: Could not create a validated object, cause: ValidateObject failed
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1233)
at Redis.clients.util.Pool.getResource(Pool.
Tags : redis,模糊删除key
发表时间:2017-01-16 00:06:50
Redis 中有删除单个 Key 的指令 DEL,但好像没有批量删除 Key 的指令,不过我们可以借助 Linux 的 xargs 指令来完成这个动作。
代码如下:
redis-cli keys “*” | xargs redis-cli del
//如果redis-cli没有设置成系统变量,需要指定redis-cli的完整路径
//如:/opt/redis/redis-cli keys “*” | xargs /opt/redis/redis-cli del
如果要指定 Redis 数据库访问密码,使
Tags : Mariadb Galer Cluster, 集群
发表时间:2017-01-14 17:55:42
Mariadb Galer Cluster 集群节点挂了,日志如下:
2017-01-09 8:30:21 140677815990016 [Warning] WSREP: Failed to report last committed 27416732, -4 (Interrupted system call)
InnoDB: Page directory corruption: infimum not pointed to
InnoDB: Page directory corruption: infimum not pointed to
2017-01-
Tags : redis
发表时间:2016-12-26 00:26:42
redis的备份和还原,借助了第三方的工具,redis-dump
1,安装redis-dump
[root@localhost tank]# yum install ruby rubygems ruby-devel //安装rubygems 以及相关包
[root@localhost tank]# gem&nb
Tags : MySQL
发表时间:2016-08-20 21:26:33
错误:Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
原因:
同一个ip在短时间内产生太多(超过mysql数据库max_connection_errors的最大值)中断的数据库连接而导致的阻塞;
解决方法:
1、提高允许的max_connection_errors数量(治标不治本):
① 进入Mysql数据库查看max_connection_errors: show variable
Tags : MYSQL,分区
发表时间:2016-06-29 21:16:06
建表语句
drop table if exists terminal_parameter;
CREATE TABLE `terminal_parameter` (
`terminal_parameter_id` int(11) NOT NULL AUTO_INCREMENT,
`serial` int(11) DEFAULT NULL,
Tags : Redis,配置文件
发表时间:2016-06-04 19:00:08
配置文件参数说明:
1. Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程
daemonize no
2. 当Redis以守护进程方式运行时,Redis默认会把pid写入/var/run/redis.pid文件,可以通过pidfile指定
pidfile /var/run/redis.pid
3. 指定
Tags : MySQL,存储过程,动态SQL
发表时间:2016-05-28 15:50:25
--存储过程名和参数,参数中in表示传入参数,out标示传出参数,inout表示传入传出参数
create procedure p_procedurecode(in sumdate varchar(10))
begin
declare v_sql varchar(500); --需要执行的SQL语句
declare sym varchar(6);
declare var1 varchar(20);
declare var2 varchar(70);
declare var3 integer;
Tags : MySQL
发表时间:2016-05-28 15:47:23
每周第一天:
SELECT CURDATE(), DATE_ADD(CURDATE(),INTERVAL -WEEKDAY(CURDATE()) DAY);
每月第一天:
SELECT CURDATE(), DATE_SUB(CURDATE(),INTERVAL DAY(CURDATE())-1 DAY);
Tags : MySQL
发表时间:2016-05-21 20:47:58
mysql> show processlist;
+—–+————-+——————–+
| Id | User | Host | db | Command | Time| State | Info
+—–+————-+——————–+
|207|root |192.168.0.2:51621 |mytest | Sleep | 5 | | NULL
|208|root |192.168.0.2:51622 |mytest | Sleep | 5 | | NULL
|220|root |192.16