mysql 5.7 innodb memcached plugin 支持内存数据库
admin
2023-05-29 11:01:14
0


http://dev.mysql.com/doc/refman/5.7/en/innodb-memcached.html


一、测试环境

mysql:5.7.15

centos:6.6_x86_64


二、安装部署


1.安装libevent

# yum install libevent -y


2.执行配置sql

# find /  -name innodb_memcached_config.sql 

(root@localhost) [(none)]> source /usr/share/mysql/innodb_memcached_config.sql


3.加载插件

(root@localhost) [test]> INSTALL PLUGIN daemon_memcached soname "libmemcached.so";


三、测试


1.默认生成的表

(root@localhost) [test]> show tables;

+----------------+

| Tables_in_test |

+----------------+

| demo_test      |

+----------------+

1 row in set (0.00 sec)


2.表结构

(root@localhost) [test]> show create table demo_test\G;

*************************** 1. row ***************************

       Table: demo_test

Create Table: CREATE TABLE `demo_test` (

  `c1` varchar(32) NOT NULL,

  `c2` varchar(1024) DEFAULT NULL,

  `c3` int(11) DEFAULT NULL,

  `c4` bigint(20) unsigned DEFAULT NULL,

  `c5` int(11) DEFAULT NULL,

  PRIMARY KEY (`c1`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8

1 row in set (0.00 sec)


ERROR: 

No query specified


3.表数据

(root@localhost) [test]> select * from demo_test;

+----+--------------+------+------+------+

| c1 | c2           | c3   | c4   | c5   |

+----+--------------+------+------+------+

| AA | HELLO, HELLO |    8 |    0 |    0 |

+----+--------------+------+------+------+

1 row in set (0.00 sec)


4.生成数据库

(root@localhost) [test]> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| innodb_memcache    |   --新生成

| mysql              |

| performance_schema |

| test               |

+--------------------+


5.新生成的表

(root@localhost) [test]> use innodb_memcache

Database changed

(root@localhost) [innodb_memcache]> show tables;

+---------------------------+

| Tables_in_innodb_memcache |

+---------------------------+

| cache_policies            |

| config_options            |

| containers                |

+---------------------------+


6.表结构以及内容

(root@localhost) [innodb_memcache]> select * from containers\G;

*************************** 1. row ***************************

                  name: aaa

             db_schema: test

              db_table: demo_test

           key_columns: c1

         value_columns: c2

                 flags: c3

            cas_column: c4

    expire_time_column: c5

unique_idx_name_on_key: PRIMARY

1 row in set (0.00 sec)


ERROR: 

No query specified


7.memcache 默认端口11211,可以修改

[root@mysql5 ~]# netstat -antp|grep 11211

tcp        0      0 0.0.0.0:11211               0.0.0.0:*                   LISTEN      4241/mysqld         

tcp        0      0 :::11211                    :::*                        LISTEN      4241/mysqld         


8.安装测试命令

# yum install telnet nc


9.使用telnet 进行读写

[root@mysql5 ~]# telnet localhost 11211

Trying ::1...

Connected to localhost.

Escape character is '^]'.

get AA

VALUE AA 8 12

HELLO, HELLO

END

set BB 10 0 16

GOODBYE, GOODBYE

STORED


10.验证数据是否修改

(root@localhost) [test]> select * from demo_test;

+----+------------------+------+------+------+

| c1 | c2               | c3   | c4   | c5   |

+----+------------------+------+------+------+

| AA | HELLO, HELLO     |    8 |    0 |    0 |

| BB | GOODBYE, GOODBYE |   10 |    1 |    0 |   --数据已修改

+----+------------------+------+------+------+


具体理论看官方文档

http://dev.mysql.com/doc/refman/5.7/en/innodb-memcached.html

相关内容

热门资讯

以开放合作释放科技革命潜能 5月18日,由中国贸促会主办的2026年全球贸易投资促进峰会在北京举行。中外与会代表围绕“新质生产力...
“6G网要来了”! 4G实现的是人人通信,5G是人机物通信,而6G将实现人、机、物、灵的通信——“灵”,即具有自主学习、...
山东商业航天走向“星辰大海” 新华社客户端济南5月21日电(记者张武岳)不久前,由烟台海阳东方航天港总装出厂的捷龙三号运载火箭,搭...
拯救者手机 Y70 新一代评测... 如果有人问我,2026年游戏手机最该卷的是什么?答案或许已经不再只是性能。过去几年,游戏手机这个品类...
光伏自动气象站:为光伏电站环境... 【推荐:仁科光伏自动气象站(型号RS-GFQXZ),工业级品质,精准可靠】在光伏电站的运行管理中,对...
充分释放场景赋能的乘数效应(感... 场景创新正在构建一个“技术赋能场景、场景反哺技术、产业支撑场景、场景带动产业”的良性生态,为培育新质...
“黄仁勋的表外甥女”,也来了 5月19日,上海前滩香格里拉酒店大厅里,身着简约正装的苏姿丰被人群团团围住。有人拿着手机高高举过头顶...
延安安塞通报10岁儿童坠亡事件 2026年4月20日,安塞区一居民小区发生一起令人痛心的儿童坠亡事件。区委、区政府对此高度重视,立即...
520当天,赖清德向大陆甩出一... 5月20日,这个常被大陆年轻人解读为“我爱你”的浪漫日子,到处洋溢着鲜花、誓言、幸福的笑脸。而在海峡...
教师参加同事婚宴连喝3场后酒驾... 教师王某受邀参加同事温某和配偶淑某的婚宴,在当天中午婚宴结束后,王某又受邀参加当天下午和晚上的两场饭...