linux下,我安装的mysql没有innodb引擎,怎么加上?

linux下,我安装的mysql没有innodb引擎,怎么加上?,第1张

首先确定,在mysql的'plugin_dir'下有ha_innodb_plugin.so和ha_innodb.so两个文件

查询'plugin_dir'的路径可以用以下命令

mysql>

show

variables

like

'plugin_dir'

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

|

Variable_name

|

Value

|

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

|

plugin_dir

|

/usr/local/mysql/lib/mysql/plugin

|

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

1

row

in

set

(0.01

sec)

如果没有找到,在您的mysql编译目录里有下面的目录文件(内置的innodb和innodb_plugin)

storage/innobase/.libs/ha_innodb.so

storage/innodb_plugin/.libs/ha_innodb_plugin.so

您需要把它们(ha_innodb_plugin.so和ha_innodb.so)拷贝到mysql的plugin目录中(/usr/local/mysql/lib/mysql/plugin)

接下来就是在mysql命令行安装一下

#

mysql

Welcome

to

the

MySQL

monitor.

Commands

end

with

or

\g.

Your

MySQL

connection

id

is

18

Server

version:

5.1.36-log

Source

distribution

Type

'help'

or

'\h'

for

help.

Type

'\c'

to

clear

the

current

input

statement.

mysql>

show

engines

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

|

Engine

|

Support

|

Comment

|

Transactions

|

XA

|

Savepoints

|

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

|

MRG_MYISAM

|

YES

|

Collection

of

identical

MyISAM

tables

|

NO

|

NO

|

NO

|

|

CSV

|

YES

|

CSV

storage

engine

|

NO

|

NO

|

NO

|

|

MEMORY

|

YES

|

Hash

based,

stored

in

memory,

useful

for

temporary

tables

|

NO

|

NO

|

NO

|

|

MyISAM

|

DEFAULT

|

Default

engine

as

of

MySQL

3.23

with

great

performance

|

NO

|

NO

|

NO

|

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

4

rows

in

set

(0.00

sec)

mysql>

INSTALL

PLUGIN

InnoDB

SONAME

'ha_innodb.so'

Query

OK,

0

rows

affected

(0.69

sec)

mysql>

show

engines

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

|

Engine

|

Support

|

Comment

|

Transactions

|

XA

|

Savepoints

|

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

|

InnoDB

|

YES

|

Supports

transactions,

row-level

locking,

and

foreign

keys

|

YES

|

YES

|

YES

|

|

CSV

|

YES

|

CSV

storage

engine

|

NO

|

NO

|

NO

|

|

MRG_MYISAM

|

YES

|

Collection

of

identical

MyISAM

tables

|

NO

|

NO

|

NO

|

|

MyISAM

|

DEFAULT

|

Default

engine

as

of

MySQL

3.23

with

great

performance

|

NO

|

NO

|

NO

|

|

MEMORY

|

YES

|

Hash

based,

stored

in

memory,

useful

for

temporary

tables

|

NO

|

NO

|

NO

|

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

5

rows

in

set

(0.00

sec)

OK,大功告成

linux查看已安装的软件的方法: 一、查看软件安装路径:Linux查看软件安装的所有路径(地址)。这里以Mysql为例。虽然安装了Mysql,但是不知道文件都安装在哪些地方、放在哪些文件夹里,可以用下面的命令查看所有的文件路径在终端输入:whereis my...

可以用于mysql。

使用HAProxy路由MySQL读请求

以下的例子使用HAProxy转发请求到两台mysql从库上。

Mysql:mysql 5.5

HAProxy IP: 172.28.10.192

Mysql Slave1:172.28.10.145

Mysql Slave2:172.28.10.150

在172.28.10.192上编译和安装haproxy

[root@cscscslocalhost 1109]# tar -zvfx haproxy-1.4.21.tar.gz

[root@cscscslocalhost haproxy-1.4.21]#make TARGET=linux26 PERFIX=/usr/local/haproxy

[root@cscscslocalhost haproxy-1.4.21]# make install PREFIX=/usr/local/haproxy

install -d /usr/local/haproxy/sbin

install haproxy /usr/local/haproxy/sbin

install -d /usr/local/haproxy/share/man/man1

install -m 644 doc/haproxy.1 /usr/local/haproxy/share/man/man1

install -d /usr/local/haproxy/doc/haproxy

for x in configuration architecture haproxy-en haproxy-frdo \

install -m 644 doc/$x.txt /usr/local/haproxy/doc/haproxy \

--查看haproxy版本,如有返回表示安装成功

[root@cscscslocalhost haproxy-1.4.21]# haproxy -v

HA-Proxy version 1.4.21 2012/05/21

Copyright 2000-2012 Willy Tarreau <w@1wt.eu>

[root@cscscslocalhost haproxy]# cd /usr/local/haproxy

--在haproxy安装目录中,新建conf和logs目录

[root@cscscslocalhost haproxy]# mkdir conf

[root@cscscslocalhost haproxy]# mkdir logs

[root@cscscslocalhost haproxy]# ls

conf doc logs sbin share

--编写haproxy的配置文件,在haproxy的软件包中examples中有例子,可以复制过来再修改.

值得注意的有轮询方式,转发方式,每服务器的权重等信息。

[root@cscscslocalhost haproxy]# vi /etc/haproxy.cfg

global

log 127.0.0.1 local0

log 127.0.0.1 local1 notice

#log loghostlocal0 info

maxconn 4096

chroot /usr/share/haproxy

uid 99

gid 99

daemon

#debug

#quiet

defaults

log global

modetcp

option httddplog

option dontlognull

retries 3

redispatch

maxconn 2000

contimeout 5000

clitimeout 50000

srvtimeout 50000

listen mysql_proxy

bind 0.0.0.0:23306

mode tcp

balance roundrobin

server db1 172.28.10.145:3307 check inter 2000 rise 2 fall 5 weight 1

server db2 172.28.10.150:3306 check inter 2000 rise 2 fall 5 weight 1

--新建对应的chroot目录,否则会报错,haproxy不能正常启动

[root@cscscslocalhost haproxy]# haproxy -f /etc/haproxy.cfg

[ALERT] 314/142955 (12657) : [haproxy.main()] Cannot chroot(/usr/share/haproxy).

[root@cscscslocalhost haproxy]# mkdir /usr/share/haproxy

--启动haproxy,查看端口,确保启动成功.

[root@cscscslocalhost haproxy]# haproxy -f /etc/haproxy.cfg

[root@cscscslocalhost haproxy]# netstat -nltp | grep haproxy

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp0 0 0.0.0.0:23306 0.0.0.0:* LISTEN 12674/haproxy

--修改日志的相关配置,让haproxy能够输出日志信息

[root@cscscslocalhost log]# vi /etc/syslog.conf

local6.* /var/log/haproxy.log

[root@cscscslocalhost haproxy]# vi /etc/sysconfig/syslog

SYSLOGD_OPTIONS=" -r -m 0"

[root@cscscslocalhost haproxy]# service syslog restart

Shutting down kernel logger: [ OK ]

Shutting down system logger: [ OK ]

Starting system logger: [ OK ]

Starting kernel logger: [ OK ]

--到此haproxy已经能够正常的转发mysql请求到后端的真正mysql服务器上了。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/7256047.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-03
下一篇 2023-04-03

发表评论

登录后才能评论

评论列表(0条)

保存