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

相关内容

热门资讯

休达移民潮观察:我在西班牙看到... 编者按7月底,西班牙北非飞地休达发生了一场震动欧洲的边境风波。七万名摩洛哥年轻人在社交媒体的信息鼓动...
上海汇正财经顾问有限公司:供给...   近期国内稀土行业供需格局改善,行业景气度重回上行通道。上海汇正财经顾问有限公司分析表示,当前稀土...
青海拉面告别“兰州拉面”,借来... 澎湃新闻主笔 沈彬近日,“兰州拉面”店招纷纷改换为“青海拉面”,成为了社会关注热点。今年6月,天津7...
新华时评|从“向新”“向优”读... 新华社北京8月5日电 题:从“向新”“向优”读懂中国经济韧性活力新华社记者王悦阳“我国经济呈现动能向...
2026线上商城哪家更好用?主... 选型误区:莫让“伪需求”绑架预算 在筛选平台之前,商家首先需要破除两个常见的选型误区。 误区一:功能...
AI虚拟主播难辨真假?这份AI... 你在看直播时,是不是也刷到过这样的画面?主播长相精致、表情恒定、动作流畅,商品展示得近乎完美,但总感...
豆包接入原生音视频全双工大模型... 8月6日,豆包正式宣布,视频通话功能升级,接入原生音视频全双工大模型SeedRealtime。 据...
销量激增100%!又一抢手货卖... 快科技8月6日消息,海关总署数据显示,今年以来我国高端智能装备外贸动能强劲,与AI相关的人工智能产品...
失控模型越来越多!Meta也报... 财联社8月6日讯(编辑 马兰)继Anthropic和OpenAI之后,Meta也加入了人工智能代理失...
新能源车换电模式对产业链有何价... 随着新能源汽车普及率不断提升,补能效率与电池管理成为行业发展的关键痛点。在此背景下,换电技术作为一种...