文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

Mysql如何在线安装其它引擎

2024-04-02 19:55

关注

这篇文章主要介绍Mysql如何在线安装其它引擎,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

mysql 在线安装sphinx存储引擎  


需要在现有mysql中安装sphinx的存储引擎,要保证现有mysql运行的情况下完成。mysql也的确支持存储引擎的在线热插拔,下面介绍安装步骤:


1、查看现有mysql的运行版本

[root@localhost plugin]# mysqladmin  -uroot -proot version  

Warning: Using a password on the command line interface can be insecure.

mysqladmin  Ver 8.42 Distrib 5.6.16, for Linux on x86_64

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Server version          5.6.16

Protocol version        10

Connection              Localhost via UNIX socket

UNIX socket             /var/lib/mysql/mysql.sock

Uptime:                 1 day 6 hours 26 min 58 sec


Threads: 1  Questions: 35  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.000



2、下载mysql和sphinx

mysql:wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz

sphinx:http://sphinxsearch.com/downloads/release/ 进去后下载:

Sphinx 2.1.7-release (r4638; Mar 30, 2014)
Mysql如何在线安装其它引擎 Source tarball (tar.gz) 2.1.7-release 2.3M Download


注意:mysql源码包的版本一定要与当前运行的mysql版本一致!


解压

# tar -xzvf mysql-5.6.16.tar.gz

# tar -xzvf sphinx-2.1.7-release.tar.gz


3、将sphinx-2.1.7-release下的mysqlse目录复制到mysql目录中

#cp -r sphinx-2.1.7-release/mysqlse/ mysql-5.6.16/storage/sphinx


build

# cd mysql-5.6.16

# sh BUILD/autorun.sh

#./configure (此步可以需要yum一些依赖的软件包,否则会有错误或警告)

# make


注意:这里到make这步即可,不用install


4、将make好的文件复制到当前运行的mysql目录中

[root@localhost sphinx]# pwd

/u/opt/mysql-5.6.16/storage/sphinx

cp ha_sphinx.so /usr/lib64/mysql/plugin/

更改所有者(这边试不改也可以)

# chown mysql.mysql /usr/lib64/mysql/plugin/*


注:我当前运行的mysql目录在/usr/local/mysql


5、登陆mysql加载sphinx引擎模块

mysql> show engines;

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

| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |

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

| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |

| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |

| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |

| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |

| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |

| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |

| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |

| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |

| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |

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

9 rows in set (0.01 sec)


mysql> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';

ERROR 1126 (HY000): Can't open shared library '/usr/lib64/mysql/plugin/ha_sphinx.so' (errno: 2 /usr/lib64/mysql/plugin/ha_sphinx.so: cannot open shared object file: No such file or directory)

这里ERROR发现第一次是ha_sphinx.so位置拷错了,拷正确后:

mysql> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';

Query OK, 0 rows affected (0.05 sec)


mysql> show engines;

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

| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |

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

| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |

| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |

| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |

| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |

| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |

| SPHINX             | YES     | Sphinx storage engine 2.1.7-release                            | NO           | NO   | NO         |

| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |

| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |

| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |

| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |

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

10 rows in set (0.00 sec)


mysql> 

安装完成!如果要卸载存储模块使用

mysql> UNINSTALL PLUGIN sphinx;  

安装好后,过了几天:

mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)

mysql>

不知道为什么找不到 SPHINX 引擎

只有重新安装一遍看,于是参考网上的:

mysql> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';
ERROR 1062 (23000): Duplicate entry 'sphinx' for key 'PRIMARY'
mysql>

mysql> UNINSTALL PLUGIN sphinx;
ERROR 1305 (42000): PLUGIN sphinx does not exist
mysql> 
mysql> 
mysql>  select * from mysql.plugin;
+--------+--------------+
| name   | dl           |
+--------+--------------+
| sphinx | ha_sphinx.so |
+--------+--------------+
1 row in set (0.00 sec)

mysql> UNINSTALL PLUGIN sphinx;
ERROR 1305 (42000): PLUGIN sphinx does not exist
mysql> 
mysql> 
mysql>  select * from mysql.plugin;
+--------+--------------+
| name   | dl           |
+--------+--------------+
| sphinx | ha_sphinx.so |
+--------+--------------+
1 row in set (0.00 sec)

mysql> 
mysql> delete from mysql.plugin where name='SPHINX';
Query OK, 1 row affected (0.02 sec)

mysql> 
mysql> 
mysql> select * from mysql.plugin;
Empty set (0.00 sec)

mysql> install plugin SPHINX soname 'ha_sphinx.so';
Query OK, 0 rows affected (0.00 sec)

mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| SPHINX             | YES     | Sphinx storage engine 2.1.7-release                            | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
10 rows in set (0.00 sec)

mysql>

在开始安装之前,查检一下mysql.plugin表,里边是不是留有老版本的SPHINXSE没有完全清理掉.

以上是“Mysql如何在线安装其它引擎”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯