mysql 5.7 innodb memcached plugin 支援記憶體資料庫

來源:互聯網
上載者:User

標籤:mysql 5.7 innodb memcached plugin 支援記憶體資料庫


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 

([email protected]) [(none)]> source /usr/share/mysql/innodb_memcached_config.sql


3.載入外掛程式

([email protected]) [test]> INSTALL PLUGIN daemon_memcached soname "libmemcached.so";


三、測試


1.預設產生的表

([email protected]) [test]> show tables;

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

| Tables_in_test |

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

| demo_test      |

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

1 row in set (0.00 sec)


2.表結構

([email protected]) [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.表資料

([email protected]) [test]> select * from demo_test;

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

| c1 | c2           | c3   | c4   | c5   |

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

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

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

1 row in set (0.00 sec)


4.產生資料庫

([email protected]) [test]> show databases;

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

| Database           |

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

| information_schema |

| innodb_memcache    |   --新產生

| mysql              |

| performance_schema |

| test               |

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


5.新產生的表

([email protected]) [test]> use innodb_memcache

Database changed

([email protected]) [innodb_memcache]> show tables;

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

| Tables_in_innodb_memcache |

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

| cache_policies            |

| config_options            |

| containers                |

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


6.表結構以及內容

([email protected]) [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,可以修改

[[email protected] ~]# 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 進行讀寫

[[email protected] ~]# 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.驗證資料是否修改

([email protected]) [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

mysql 5.7 innodb memcached plugin 支援記憶體資料庫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.