mysql集群 配置Keepalived+mmWord下载.docx
《mysql集群 配置Keepalived+mmWord下载.docx》由会员分享,可在线阅读,更多相关《mysql集群 配置Keepalived+mmWord下载.docx(14页珍藏版)》请在冰豆网上搜索。
or
\g.
4.Your
connection
id
is
9
5.Server
version:
5.6.15
Community
Server
(GPL)
6.
7.Copyright
(c)
2000,
2013,
Oracle
and/or
its
affiliates.
All
rights
reserved.
8.
9.Oracle
a
registered
trademark
of
Corporation
10.affiliates.
Other
names
may
be
trademarks
their
respective
11.owners.
12.
13.Type
'
help;
\h'
for
help.
Type
\c'
clear
current
input
statement.
14.
15.mysql>
use
mysql;
16.Reading
table
information
completion
and
column
17.You
can
turn
off
this
feature
get
quicker
startup
-A
18.
19.Database
changed
20.mysql>
select
host,
user
from
user;
21.+-----------------------+------+
22.|
host
|
23.+-----------------------+------+
24.|
127.0.0.1
root
25.|
:
1
26.|
localhost
27.|
localhost.localdomain
28.+-----------------------+------+
29.
30.mysql>
update
set
=
%'
where
31.ERROR
1062
(23000):
Duplicate
entry
%-root'
key
PRIMARY'
--
这个无所谓
32.
33.mysql>
34.+-----------------------+------+
35.|
36.+-----------------------+------+
37.|
%
38.|
39.|
40.|
41.+-----------------------+------+
42.4
rows
in
(0.00
sec)
43.
44.mysql>
FLUSH
PRIVILEGES
45.
->
46.Query
OK,
0
affected
47.
48.mysql>
version();
49.+-----------+
50.|
version()
51.+-----------+
52.|
53.+-----------+
54.1
row
【配置第2个节点79】
以同样的方式配置6.79
步骤同上(省略)
【主从配置】
先以79作为主数据库,235作从数据库
看看79的/etc/f
more
/etc/f
2.#
Example
config
file
medium
systems.
3.#
4.#
This
system
little
memory
(32M
-
64M)
plays
5.#
an
important
part,
systems
up
128M
used
together
6.#
other
programs
(such
as
web
server)
7.#
8.#
look
option
files
9.#
locations
which
depend
on
deployment
platform.
10.#
You
copy
one
those
11.#
locations.
For
about
these
locations,
see:
12.#
13.#
14.#
In
file,
you
all
long
options
that
program
supports.
15.#
If
want
know
supports,
run
16.#
"
--help"
option.
17.
18.#
The
following
will
passed
clients
19.[client]
20.#password
your_password
21.port
3306
22.socket
/tmp/mysql.sock
23.
24.#
Here
follows
entries
some
specific
25.
26.#
server
27.[mysqld]
28.port
29.socket
30.skip-external-locking
31.key_buffer_size
16M
32.max_allowed_packet
1M
33.table_open_cache
64
34.sort_buffer_size
512K
35.net_buffer_length
8K
36.read_buffer_size
256K
37.read_rnd_buffer_size
38.myisam_sort_buffer_size
8M
39.lower_case_table_names=1
<
span
style="
color:
#ff0000;
>
#忽略大小写<
/span>
40.#
binary
logging
format
mixed
recommended
41.binlog_format=mixed
42.
43.#
required
unique
between
2^32
44.#
defaults
if
master-host
not
45.#
but
function
master
omitted
46.<
server-id
#第一个节点
47.<
binlog-do-db
=roamingsms_v1
#主库(要同步的数据库)
48.<
replicate-do-db
roamingsms_v1<
#从库<
49.<
binlog-ignore-db=mysql
#忽略的数据库
50.<
binlog-ignore-db=test
#忽略的数据库<
51.log-bin=mysql-bin
52.
53.
54.#
Uncomment
are
using
InnoDB
tables
55.#innodb_data_home_dir
/usr/local/mysql/var
56.#innodb_data_file_path
ibdata1:
10M:
autoextend
57.#innodb_log_group_home_dir
58.#
.._buffer_pool_size
50
80
59.#
RAM
beware
setting
usage
too
high
60.#innodb_buffer_pool_size
61.#innodb_additional_mem_pool_size
2M
62.#
Set
.._log_file_size
25
buffer
pool
size
63.#innodb_log_file_size
5M
64.#innodb_log_buffer_size
65.#innodb_flush_log_at_trx_commit
66.#innodb_lock_wait_timeout
67.
68.[mysqldump]
69.quick
70.max_allowed_packet
71.
72.[mysql]
73.no-auto-rehash
74.#
Remove
next
comment
character
familiar
SQL
75.#safe-updates
76.
77.[myisamchk]
78.key_buffer_size
20M
79.sort_buffer_size
80.read_buffer
81.write_buffer
82.
83.[mysqlhotcopy]
84.interactive-timeout
看看235的/etc/f
1.<
#000000;
[root@localhost
2.[client]
3.#password
4.port
5.socket
10.[mysqld]
11.port
12.socket
13.skip-external-locking
14.key_buffer_size
15.max_allowed_packet
16.table_open_cache
17.sort_buffer_size
18.net_buffer_length
19.read_buffer_size
20.read_rnd_buffer_size
21.myisam_sort_buffer_size
22.lower_case_table_names=1
#
大小写忽略
23.<
25.binlog_format=mixed
26.
27.#
28.#
29.#
30.<
2
#节点2,每个节点只要不一样就行,不一定是2
31.<
roamingsms_v1
#从库(同步的数据库)
32.log-bin
mysql-bin
#同步的日志
33.<
34.[mysqldump]
35.quick
36.max_allowed_packet
37.
38.[mysql]
39.no-auto-rehash
41.#safe-updates
43.[myisamchk]<
在主库79重启mysql
#servicemysqldrestart
#重启mysql
登陆Mysql
mysql>
grantreplicationslave,reload,superon*.*to'
sync'
identifiedby'
mengliang'
#分配一个用户用于同步
flushprivileges;
#权限生效
showmasterstatus;
+------------------+----------+---------------+------------------+-------------------+
|File
|Position|Binlog_Do_DB
|Binlog_Ignore_DB|Executed_Gtid_Set|
|mysql-bin.000046|
120|roamingsms_v1|mysql,test
|
|
1rowinset(0.00sec)
在从库235
flushlogs;
stopslave;
resetslave;
changemastertomaster_host='
192.168.6.79'
master_user='
master_password='
broadtech'
master_log_file='
mysql-bin.000046'
master_log_pos=120;
showslavestatus\G;
#查看状态
主从配置成功。
先以235作为主数据库,79作从数据库
在235
#servicemysqldrestart#重启mysql
+------------------+----------+--------------+------------------+-------------------+
|Position|Binlog_Do_DB|Binlog_Ignore_DB|Executed_Gtid_Set|
|mysql-bin.000007|
725|
然后再79配置
mysql-bin.000007'
master_log_pos=725;
#查看状态
从主配置完成
Slave_IO_Running: