一台电脑两个mysql服务&主从服务配置

一台电脑两个mysql服务&主从服务配置

预置条件:winxp、已存在一个mysql-5.5.20-win32服务(目录在D:\softbak\web\mysql-5.5.20-win32\mysql-5.5.20-win32)


如何在一台电脑上面再启动一个mysql服务了?(参考自http://lxzjsj.iteye.com/blog/758018

1、将mysql的zip包重新拷贝的另一个目录下:D:\softbak\web\mysql-5.5.20-win32\mysql2

2、打开my.ini文件,并修改几处地方:

a:端口好port=3306改成port=3307

b:更改两个路径:basedir=D:\softbak\web\mysql-5.5.20-win32\mysql2

datadir=D:\softbak\web\mysql-5.5.20-win32\mysql\data

c:这个要作为从服务,需要把server-id=1改成server-id = 10

3、 安装服务

命令提示符: D:\softbak\web\mysql-5.5.20-win32\mysql2\bin>mysqld --install mysql2 --defaults-file=D:\softbak\web\mysql-5.5.20-win32\mysql2\my.ini

4、 开启服务

命令提示符:  D:\softbak\web\mysql-5.5.20-win32\mysql2\bin >net start mysql2 或者在服务中手动开启(中间又一次出现1068错误,查看下原来端口号忘记改了)

ps:其他对你有用的操作:

停止服务

命令提示符:  net stop mysql2 或者在服务中手动停止

 删除服务

命令提示符:  net stop mysql2

命令提示符:   mysqld --remove mysql2 

5、你登录不同服务的时候,需要根据端口号来区别:

登录主服务默认是3306端口:mysql -uroot -p

登录从服务是3307端口:mysql -P3307 -uroot -p

如何进行主从服务器配置:查考下面这个网址

http://2526575.blog.51cto.com/2516575/689199

 

主从和集群一个区别:

在复制系统中,一个MySQL主服务器会更新一个或多个从服务器.事务是顺序地提交的,因此一个慢事务就可能导致从服务器比主服务器落后一段时间.这也意味着,如果主服务器出错失败了,那么从服务器可能会缺少记录最后的那一小部分事务日志.如果使用的是事务安全存储引擎的话,例如InnoDB,那么事务日志则会完全记录到从服务器上去或者完全不记录,但是复制不能保证主和从服务器上的数据总是保持一致性.在MySQL集群中,所有的数据总是保持同步,在任何数据节点上提交的事务都同步到所有其他的数据节点上了.如果有一个数据节点失败了,其他正常的数据节点照样能保持数据的一致性.

24.10.5: What is the difference between using MySQL Cluster vs using MySQL replication? 
In traditional MySQL replication, a master MySQL server updates one or more slaves. Transactions are committed sequentially, and a slow transaction can cause the slave to lag behind the master. This means that if the master fails, it is possible that the slave might not have recorded the last few transactions. If a transaction-safe engine such as InnoDB is being used, a transaction will either be complete on the slave or not applied at all, but replication does not guarantee that all data on the master and the slave will be consistent at all times. In MySQL Cluster, all data nodes are kept in synchrony, and a transaction committed by any one data node is committed for all data nodes. In the event of a data node failure, all remaining data nodes remain in a consistent state. 
In short, whereas standard MySQL replication is asynchronous, MySQL Cluster is synchronous. 
We have implemented (asynchronous) replication for Cluster in MySQL 5.1 and later. MySQL Cluster Replication (also sometimes known as “geo-replication”) includes the capability to replicate both between two MySQL Clusters, and from a MySQL Cluster to a non-Cluster MySQL server. However, we do not plan to backport this functionality to MySQL 5.1. See Section 17.6, “MySQL Cluster Replication”. 

猜你喜欢

转载自gsdhaiji-cai.iteye.com/blog/1545694