MySQL 5.6 安装配置InnoDB memcached Plugin

准备工作, 安装libmemached包,提供一些memcat/cp/dump命令,方便测试。
# yum install libmemcached.x86_64 -y

1. Setup required tables.
mysql> source MYSQL_HOME/share/innodb_memcached_config.sql
Query OK, 1 row affected (0.00 sec)

Database changed
Query OK, 0 rows affected (0.04 sec)

Query OK, 0 rows affected (0.04 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Database changed
Query OK, 0 rows affected (0.03 sec)

Query OK, 1 row affected (0.01 sec)

[root@localhost:test 11:58:56]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| db01               |
| innodb_memcache    |
| mysql              |
| performance_schema |
| test               |
+--------------------+
6 rows in set (0.00 sec)

[root@localhost:innodb_memcache 12:04:01]> show tables;
+---------------------------+
| Tables_in_innodb_memcache |
+---------------------------+
| cache_policies            |
| config_options            |
| containers                |
+---------------------------+
3 rows in set (0.00 sec)

2. Install the daemon plugin
mysql> install plugin daemon_memcached soname "libmemcached.so";

Uninstall the daemon plugin
mysql> uninstall plugin daemon_memcached;

3. Start memcache
a. Set variable daemon_memcached_option when mysql is running.
> set global variable daemon_memcached_option = '-p11222'

b. Set option daemon_memcached_option during mysql start.
$ mysqld .... --daemon_memcached_option="-p11222"

c. Set daemon_memcached_option in my.cnf.
$ grep -i memcache /usr/local/mysql/my.cnf
daemon_memcached_option="-p11222"

4. Verify memcache status.
a. Check listen port.
[mysql@slc4-ra0002pxe159 ~]$ netstat -nultpa|grep -i list                 
tcp        0      0 :::11222                    :::*                        LISTEN      681/mysqld

b. Check memcache contents.
$ export MEMCACHED_SERVERS=127.0.0.1:11222
$ touch memcache/mime.types
$ memcp memcache/mime.types
$ memcat memcache/mime.types

$ telnet 127.0.0.1 11222
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
set all 10 0 9
123456789
STORED
get all
VALUE all 10 9
123456789
END
quit
Connection closed by foreign host.

[root@localhost:innodb_memcache 12:24:09]> select *  from test.demo_test;
+------------+-----------+------+------+------+
| c1         | c2        | c3   | c4   | c5   |
+------------+-----------+------+------+------+
| all        | 123456789 |   10 |    2 |    0 |
| mime.types |           |    0 |    1 |    0 |
+------------+-----------+------+------+------+
2 rows in set (0.00 sec)

5. Tuning memcache.
[root@localhost:test 11:56:44]> show variables like '%memcache%';
+----------------------------------+------------------+
| Variable_name                    | Value            |
+----------------------------------+------------------+
| daemon_memcached_enable_binlog   | OFF              |
| daemon_memcached_engine_lib_name | innodb_engine.so |
| daemon_memcached_engine_lib_path |                  |
| daemon_memcached_option          | -p11222          |
| daemon_memcached_r_batch_size    | 1                |
| daemon_memcached_w_batch_size    | 1                |
+----------------------------------+------------------+

daemon_memcached_r_batch_size batch commit size for read operations (get). It specifies after how many memcached read operations the system automatically does a commit. By default, this is set to 1 so that every get request can access the very latest committed data in the InnoDB table, whether the data was updated through memcached or by SQL. When its value is greater than 1, the counter for read operations is incremented once for every get call. The flush_all call resets both the read and write counters.

daemon_memcached_w_batch_size batch commit for any write operations (set, replace, append, prepend, incr, decr, and so on) By default, this is set as 1, so that no uncommitted data is lost in case of an outage, and any SQL queries on the underlying table can access the very latest data. When its value is greater than 1, the counter for write operations is incremented once for every add, set, incr, decr, and delete call. The flush_all call resets both the read and write counters.

转载于:https://www.cnblogs.com/torvalds0310/p/4234169.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MySQL 5.6自定义安装配置教程如下: 1. 下载MySQL 5.6安装包,可以从官网下载,也可以从其他可信渠道下载。 2. 解压安装包,将解压后的文件夹复制到你想安装的目录下。 3. 进入MySQL安装目录,找到my-default.ini文件,将其复制并重命名为my.ini。 4. 打开my.ini文件,进行以下配置: (1) 修改[mysql]部分的默认字符集为utf8mb4:default-character-set=utf8mb4 (2) 修改[mysqld]部分的默认字符集为utf8mb4:character-set-server=utf8mb4 (3) 修改[mysqld]部分的默认存储引擎为InnoDB:default-storage-engine=InnoDB (4) 修改[mysqld]部分的日志文件路径: log-error=<安装目录>\mysql_error.log general-log-file=<安装目录>\mysql_general.log slow-query-log-file=<安装目录>\mysql_slow.log (5) 如果需要设置MySQL的root用户密码,则需要在[mysqld]部分加上以下一行: skip-grant-tables 然后保存文件并退出。 5. 打开cmd命令行窗口,进入MySQL的bin目录,执行以下命令: (1) 初始化MySQL数据目录:mysqld --initialize --console (2) 安装MySQL服务:mysqld install (3) 启动MySQL服务:net start mysql 6. 如果在步骤4中设置了root用户密码,则需要执行以下命令取消skip-grant-tables选项: (1) 打开my.ini文件,注释掉skip-grant-tables这一行。 (2) 重启MySQL服务:net stop mysql && net start mysql 7. 进入MySQL的bin目录,打开mysql.exe客户端,输入用户名和密码登录MySQL数据库。 希望以上步骤能够帮助你成功安装配置MySQL 5.6。如果你有其他问题,请继续提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值