一、需求说明

最近一直在学习mysql-mmm,想以后这个架构也能用在我们公司的业务上,我们公司的业务是单机多实例部署,所以也想把mysql-mmm部署成这样,功夫不负有心人,我成功了,和大家分享一下:
二、环境说明

集群 角色 主机名 IP Mysql Port Server ID VIP Writer VIP READER
navy2 Agent db1 172.28.26.101 3307 11 172.28.26.107
navy3
Agent
db2 172.28.26.102 3308 1
172.28.26.110
navy2
Agent
db1
172.28.26.101
3307 22
172.28.26.108
navy3
Agent
db2
172.28.26.102
3308 2
172.28.26.109
navy2/navy3 Monitor
Monitor
172.28.26.103
PS:db1和db2上分别有两个库navy2和navy3,互为主主,172.28.26.107是navy2的写入虚拟IP,172.28.26.108是navy2的读虚拟IP,172.28.26.109是navy2的写入虚拟IP,172.28.26.110是navy3的读虚拟IP。
三、部署
1、mysql和mysql-mmm的安装及mysql的主从配置请查看前面的博文:http://navyaijm.blog.51cto.com/4647068/1230674,这里只介绍mmm多实例配置。
2、db1上:
vi /etc/mysql-mmm/mmm_common_navy2.conf(navy2的配置文件)
 
 1 vi /etc/mysql-mmm/mmm_common_navy2.conf
2 active_master_role writer
3 <host default>
4 cluster_interface eth1
5 agent_port 9912
6 mysql_port 3307
7 pid_path /var/run/mysql-mmm/mmm_agentd_navy2.pid
8 bin_path /usr/libexec/mysql-mmm/
9 replication_user slave
10 replication_password 123456
11 agent_user mmm_agent
12 agent_password 123456
13 </host>
14 <host db1>
15 ip 172.28.26.101
16 mysql_port 3307
17 mode master
18 peer db2
19 </host>
20 <host db2>
21 ip 172.28.26.102
22 mysql_port 3307
23 mode master
24 peer db1
25 </host>
26 <role writer>
27 hosts db1, db2
28 ips 172.28.26.107
29 mode exclusive
30 </role>
31 <role reader>
32 hosts db1, db2
33 ips 172.28.26.108
34 mode balanced
35 </role>

vi /etc/mysql-mmm/mmm_common_navy3.conf(navy的配置文件)

 1 active_master_role      writer
2 <host default>
3 cluster_interface eth1
4 agent_port 9913
5 mysql_port 3308
6 pid_path /var/run/mysql-mmm/mmm_agentd_navy3.pid
7 bin_path /usr/libexec/mysql-mmm/
8 replication_user slave
9 replication_password 123456
10 agent_user mmm_agent
11 agent_password 123456
12 </host>
13 <host db1>
14 ip 172.28.26.101
15 mysql_port 3308
16 mode master
17 peer db2
18 </host>
19 <host db2>
20 ip 172.28.26.102
21 mysql_port 3308
22 mode master
23 peer db1
24 </host>
25 <role writer>
26 hosts db1, db2
27 ips 172.28.26.109
28 mode exclusive
29 </role>
30 <role reader>
31 hosts db1, db2
32 ips 172.28.26.110
33 mode balanced
34 </role>

vi /etc/mysql-mmm/mmm_agent_navy2.conf(navy2的agent配置文件)

1 include mmm_common_navy2.conf
2 this db1

vi /etc/mysql-mmm/mmm_agent_navy3.conf(navy3的agent配置文件)

1 include mmm_common_navy3.conf
2 this db1

vi /etc/init.d/mysql-mmm-agent-navy2(navy2的agent启动脚本)

 1 #!/bin/sh
2 # chkconfig: - 64 36
3 # description: MMM Agent.
4 # processname: mmm_agentd
5 # config: /etc/mysql-mmm/mmm_agent.conf
6 # pidfile: /var/run/mysql-mmm/mmm_agentd.pid
7 # Source function library and defaults file.
8 . /etc/rc.d/init.d/functions
9 . /etc/default/mysql-mmm-agent
10 # Cluster name (it can be empty for default cases)
11 CLUSTER='navy2'
12 LOCKFILE='/var/lock/subsys/mysql-mmm-agent_navy2'
13 prog='MMM Agent Daemon'
14 #-----------------------------------------------------------------------
15 # Paths
16 if [ "$CLUSTER" != "" ]; then
17 MMMD_AGENT_BIN="/usr/sbin/mmm_agentd @$CLUSTER"
18 MMMD_AGENT_PIDFILE="/var/run/mysql-mmm/mmm_agentd_$CLUSTER.pid"
19 else
20 MMMD_AGENT_BIN="/usr/sbin/mmm_agentd"
21 MMMD_AGENT_PIDFILE="/var/run/mysql-mmm/mmm_agentd.pid"
22 fi
23 start() {
24 if [ "${ENABLED}" != "1" ]; then
25 echo "$prog is disabled!"
26 exit 1
27 fi
28 echo -n "Starting $prog: "
29 if [ -s $MMMD_AGENT_PIDFILE ] && kill -0 `cat $MMMD_AGENT_PIDFILE` 2> /dev/null; then
30 echo " already running."
31 exit 0
32 fi
33 daemon $MMMD_AGENT_BIN
34 RETVAL=$?
35 echo
36 [ $RETVAL = 0 ] && touch $LOCKFILE
37 return $RETVAL
38 }
39 stop() {
40 # Stop daemon.
41 echo -n "Stopping $prog: "
42 killproc -p $MMMD_AGENT_PIDFILE $MMMD_AGENT_BIN
43 RETVAL=$?
44 echo
45 [ $RETVAL = 0 ] && rm -f $LOCKFILE
46 return $RETVAL
47 }
48 case "$1" in
49 start)
50 start
51 ;;
52 stop)
53 stop
54 ;;
55 status)
56 status -p $MMMD_AGENT_PIDFILE $MMMD_AGENT_BIN
57 RETVAL=$?
58 ;;
59 restart|reload)
60 stop
61 start
62 ;;
63 condrestart)
64 if [ -f $LOCKFILE ]; then
65 stop
66 start
67 fi
68 ;;
69 *)
70 echo "Usage: $0 {start|stop|restart|condrestart|status}"
71 ;;
72 esac
73 exit $RETVAL

赋予执行权限:

1 chmod +x /etc/init.d/mysql-mmm-agent-navy2

vi /etc/init.d/mysql-mmm-agent-navy3(navy3的agent启动脚本)

 1 #!/bin/sh
2 # chkconfig: - 64 36
3 # description: MMM Agent.
4 # processname: mmm_agentd
5 # config: /etc/mysql-mmm/mmm_agent.conf
6 # pidfile: /var/run/mysql-mmm/mmm_agentd.pid
7 # Source function library and defaults file.
8 . /etc/rc.d/init.d/functions
9 . /etc/default/mysql-mmm-agent
10 ## Paths
11 #MMMD_AGENT_BIN="/usr/sbin/mmm_agentd"
12 #MMMD_AGENT_PIDFILE="/var/run/mysql-mmm/mmm_agentd.pid"
13 #LOCKFILE='/var/lock/subsys/mysql-mmm-agent'
14 #prog='MMM Agent Daemon'
15 # Cluster name (it can be empty for default cases)
16 CLUSTER='navy3'
17 LOCKFILE='/var/lock/subsys/mysql-mmm-agent_navy3'
18 prog='MMM Agent Daemon'
19 #-----------------------------------------------------------------------
20 # Paths
21 if [ "$CLUSTER" != "" ]; then
22 MMMD_AGENT_BIN="/usr/sbin/mmm_agentd @$CLUSTER"
23 MMMD_AGENT_PIDFILE="/var/run/mysql-mmm/mmm_agentd_$CLUSTER.pid"
24 else
25 MMMD_AGENT_BIN="/usr/sbin/mmm_agentd"
26 MMMD_AGENT_PIDFILE="/var/run/mysql-mmm/mmm_agentd.pid"
27 fi
28 start() {
29 if [ "${ENABLED}" != "1" ]; then
30 echo "$prog is disabled!"
31 exit 1
32 fi
33 echo -n "Starting $prog: "
34 if [ -s $MMMD_AGENT_PIDFILE ] && kill -0 `cat $MMMD_AGENT_PIDFILE` 2> /dev/null; then
35 echo " already running."
36 exit 0
37 fi
38 daemon $MMMD_AGENT_BIN
39 RETVAL=$?
40 echo
41 [ $RETVAL = 0 ] && touch $LOCKFILE
42 return $RETVAL
43 }
44 stop() {
45 # Stop daemon.
46 echo -n "Stopping $prog: "
47 killproc -p $MMMD_AGENT_PIDFILE $MMMD_AGENT_BIN
48 RETVAL=$?
49 echo
50 [ $RETVAL = 0 ] && rm -f $LOCKFILE
51 return $RETVAL
52 }
53 case "$1" in
54 start)
55 start
56 ;;
57 stop)
58 stop
59 ;;
60 status)
61 status -p $MMMD_AGENT_PIDFILE $MMMD_AGENT_BIN
62 RETVAL=$?
63 ;;
64 restart|reload)
65 stop
66 start
67 ;;
68 condrestart)
69 if [ -f $LOCKFILE ]; then
70 stop
71 start
72 fi
73 ;;
74 *)
75 echo "Usage: $0 {start|stop|restart|condrestart|status}"
76 ;;
77 esac
78 exit $RETVAL

赋予可执行权限:

1 chmod +x /etc/init.d/mysql-mmm-agent-navy3

启动服务:

1 /etc/init.d/mysql-mmm-agent-navy2 start
2 /etc/init.d/mysql-mmm-agent-navy3 start
3、db2上:
复制db1上的文件到相应的目录下:
 
1 scp /etc/mysql-mmm/mmm_common_navy2.conf 172.28.26.102:/etc/mysql-mmm/
2 scp /etc/mysql-mmm/mmm_common_navy3.conf 172.28.26.102:/etc/mysql-mmm/
3 scp /etc/mysql-mmm/mmm_agent_navy2.conf 172.28.26.102:/etc/mysql-mmm/
4 scp /etc/mysql-mmm/mmm_agent_navy3.conf 172.28.26.102:/etc/mysql-mmm/
5 scp /etc/init.d/mysql-mmm-agent-navy2 172.28.26.102:/etc/init.d/
6 scp /etc/init.d/mysql-mmm-agent-navy3 172.28.26.102:/etc/init.d/

修改agent配置文件:

1 sed -i 's/this db1/this db2/' /etc/mysql-mmm/mmm_agent_navy2.conf
2 sed -i 's/this db1/this db2/' /etc/mysql-mmm/mmm_agent_navy3.conf

赋予可执行权限

1 chmod +x /etc/init.d/mysql-mmm-agent-navy2
2 chmod +x /etc/init.d/mysql-mmm-agent-navy3

启动服务:

1 /etc/init.d/mysql-mmm-agent-navy2 start
2 /etc/init.d/mysql-mmm-agent-navy3 start
4、monitor上
复制db1上的配置文件:
1 scp /etc/mysql-mmm/mmm_common_navy2.conf 172.28.26.103:/etc/mysql-mmm/
2 scp /etc/mysql-mmm/mmm_common_navy3.conf 172.28.26.103:/etc/mysql-mmm/

vi /etc/mysql-mmm/mmm_mon_navy2.conf

 1 include mmm_common_navy2.conf
2 <monitor>
3 ip 127.0.0.1
4 port 9992
5 pid_path /var/run/mysql-mmm/mmm_mond_navy2.pid
6 bin_path /usr/libexec/mysql-mmm
7 status_path /var/lib/mysql-mmm/mmm_mond_navy2.status
8 ping_ips 172.28.26.101,172.28.26.102
9 auto_set_online 10
10 # wait_for_other_master 2
11 # The kill_host_bin does not exist by default, though the monitor will
12 # throw a warning about it missing. See the section 5.10 "Kill Host
13 # Functionality" in the PDF documentation.
14 #
15 # kill_host_bin /usr/libexec/mysql-mmm/monitor/kill_host
16 #
17 </monitor>
18 <host default>
19 monitor_user mmm_monitor
20 monitor_password 123456
21 </host>
22 debug 0

vi /etc/mysql-mmm/mmm_mon_navy3.conf

 1 include mmm_common_navy3.conf
2 <monitor>
3 ip 127.0.0.1
4 port 9993
5 pid_path /var/run/mysql-mmm/mmm_mond_navy3.pid
6 bin_path /usr/libexec/mysql-mmm
7 status_path /var/lib/mysql-mmm/mmm_mond_navy3.status
8 ping_ips 172.28.26.101,172.28.26.102
9 auto_set_online 10
10 # wait_for_other_master 2
11 # The kill_host_bin does not exist by default, though the monitor will
12 # throw a warning about it missing. See the section 5.10 "Kill Host
13 # Functionality" in the PDF documentation.
14 #
15 # kill_host_bin /usr/libexec/mysql-mmm/monitor/kill_host
16 #
17 </monitor>
18 <host default>
19 monitor_user mmm_monitor
20 monitor_password 123456
21 </host>
22 debug 0

vi /etc/mysql-mmm/mmm_mon_log_navy2.conf

 1 #log4perl.logger = FATAL, MMMLog, MailFatal
2 log4perl.logger = FATAL, MMMLog
3 log4perl.appender.MMMLog = Log::Log4perl::Appender::File
4 log4perl.appender.MMMLog.Threshold = INFO
5 log4perl.appender.MMMLog.filename = /var/log/mysql-mmm/mmm_mond_navy2.log
6 log4perl.appender.MMMLog.recreate = 1
7 log4perl.appender.MMMLog.layout = PatternLayout
8 log4perl.appender.MMMLog.layout.ConversionPattern = %d %5p %m%n
9 #log4perl.appender.MailFatal = Log::Dispatch::Email::MailSender
10 #log4perl.appender.MailFatal.Threshold = FATAL
11 #log4perl.appender.MailFatal.from = mmm@example.com
12 #log4perl.appender.MailFatal.to = root
13 #log4perl.appender.MailFatal.buffered = 0
14 #log4perl.appender.MailFatal.subject = FATAL error in mysql-mmm-monitor
15 #log4perl.appender.MailFatal.layout = PatternLayout
16 #log4perl.appender.MailFatal.layout.ConversionPattern = %d %m%n

vi /etc/mysql-mmm/mmm_mon_log_navy3.conf

 1 #log4perl.logger = FATAL, MMMLog, MailFatal
2 log4perl.logger = FATAL, MMMLog
3 log4perl.appender.MMMLog = Log::Log4perl::Appender::File
4 log4perl.appender.MMMLog.Threshold = INFO
5 log4perl.appender.MMMLog.filename = /var/log/mysql-mmm/mmm_mond_navy3.log
6 log4perl.appender.MMMLog.recreate = 1
7 log4perl.appender.MMMLog.layout = PatternLayout
8 log4perl.appender.MMMLog.layout.ConversionPattern = %d %5p %m%n
9 #log4perl.appender.MailFatal = Log::Dispatch::Email::MailSender
10 #log4perl.appender.MailFatal.Threshold = FATAL
11 #log4perl.appender.MailFatal.from = mmm@example.com
12 #log4perl.appender.MailFatal.to = root
13 #log4perl.appender.MailFatal.buffered = 0
14 #log4perl.appender.MailFatal.subject = FATAL error in mysql-mmm-monitor
15 #log4perl.appender.MailFatal.layout = PatternLayout
16 #log4perl.appender.MailFatal.layout.ConversionPattern = %d %m%n

vi /etc/init.d/mysql-mmm-monitor-navy2

 1 #!/bin/sh
2 #
3 # mysql-mmm-monitor This shell script takes care of starting and stopping
4 # the mmm monitoring daemon.
5 #
6 # chkconfig: - 64 36
7 # description: MMM Monitor.
8 # processname: mmm_mond
9 # config: /etc/mysql-mmm/mmm_mon.conf
10 # pidfile: /var/run/mysql-mmm/mmm_mond.pid
11 # Source function library and defaults file.
12 . /etc/rc.d/init.d/functions
13 . /etc/default/mysql-mmm-monitor
14 # Cluster name (it can be empty for default cases)
15 CLUSTER='navy2'
16 LOCKFILE='/var/lock/subsys/mysql-mmm-monitor_navy2'
17 prog='MMM Monitor Daemon'
18 if [ "$CLUSTER" != "" ]; then
19 MMMD_MON_BIN="/usr/sbin/mmm_mond @$CLUSTER"
20 MMMD_MON_PIDFILE="/var/run/mysql-mmm/mmm_mond-$CLUSTER.pid"
21 else
22 MMMD_MON_BIN="/usr/sbin/mmm_mond"
23 MMMD_MON_PIDFILE="/var/run/mysql-mmm/mmm_mond.pid"
24 fi
25 start() {
26 if [ "${ENABLED}" != "1" ]; then
27 echo "$prog is disabled!"
28 exit 1
29 fi
30 echo -n "Starting $prog: "
31 if [ -s $MMMD_MON_PIDFILE ] && kill -0 `cat $MMMD_MON_PIDFILE` 2> /dev/null; then
32 echo " already running."
33 exit 0
34 fi
35 daemon $MMMD_MON_BIN
36 RETVAL=$?
37 echo
38 [ $RETVAL = 0 ] && touch $LOCKFILE
39 return $RETVAL
40 }
41 stop() {
42 # Stop daemon.
43 echo -n "Stopping $prog: "
44 killproc -p $MMMD_MON_PIDFILE $MMMD_MON_BIN
45 RETVAL=$?
46 echo
47 [ $RETVAL = 0 ] && rm -f $LOCKFILE
48 return $RETVAL
49 }
50 case "$1" in
51 start)
52 start
53 ;;
54 stop)
55 stop
56 ;;
57 status)
58 status -p $MMMD_MON_PIDFILE $MMMD_MON_BIN
59 RETVAL=$?
60 ;;
61 restart|reload)
62 stop
63 start
64 ;;
65 condrestart)
66 if [ -f $LOCKFILE ]; then
67 stop
68 start
69 fi
70 ;;
71 *)
72 echo "Usage: $0 {start|stop|restart|condrestart|status}"
73 ;;
74 esac
75 exit $RETVAL

vi /etc/init.d/mysql-mmm-monitor-navy3

 1 #!/bin/sh
2 #
3 # mysql-mmm-monitor This shell script takes care of starting and stopping
4 # the mmm monitoring daemon.
5 #
6 # chkconfig: - 64 36
7 # description: MMM Monitor.
8 # processname: mmm_mond
9 # config: /etc/mysql-mmm/mmm_mon.conf
10 # pidfile: /var/run/mysql-mmm/mmm_mond.pid
11 # Source function library and defaults file.
12 . /etc/rc.d/init.d/functions
13 . /etc/default/mysql-mmm-monitor
14 # Cluster name (it can be empty for default cases)
15 CLUSTER='navy3'
16 LOCKFILE='/var/lock/subsys/mysql-mmm-monitor_navy3'
17 prog='MMM Monitor Daemon'
18 if [ "$CLUSTER" != "" ]; then
19 MMMD_MON_BIN="/usr/sbin/mmm_mond @$CLUSTER"
20 MMMD_MON_PIDFILE="/var/run/mysql-mmm/mmm_mond-$CLUSTER.pid"
21 else
22 MMMD_MON_BIN="/usr/sbin/mmm_mond"
23 MMMD_MON_PIDFILE="/var/run/mysql-mmm/mmm_mond.pid"
24 fi
25 start() {
26 if [ "${ENABLED}" != "1" ]; then
27 echo "$prog is disabled!"
28 exit 1
29 fi
30 echo -n "Starting $prog: "
31 if [ -s $MMMD_MON_PIDFILE ] && kill -0 `cat $MMMD_MON_PIDFILE` 2> /dev/null; then
32 echo " already running."
33 exit 0
34 fi
35 daemon $MMMD_MON_BIN
36 RETVAL=$?
37 echo
38 [ $RETVAL = 0 ] && touch $LOCKFILE
39 return $RETVAL
40 }
41 stop() {
42 # Stop daemon.
43 echo -n "Stopping $prog: "
44 killproc -p $MMMD_MON_PIDFILE $MMMD_MON_BIN
45 RETVAL=$?
46 echo
47 [ $RETVAL = 0 ] && rm -f $LOCKFILE
48 return $RETVAL
49 }
50 case "$1" in
51 start)
52 start
53 ;;
54 stop)
55 stop
56 ;;
57 status)
58 status -p $MMMD_MON_PIDFILE $MMMD_MON_BIN
59 RETVAL=$?
60 ;;
61 restart|reload)
62 stop
63 start
64 ;;
65 condrestart)
66 if [ -f $LOCKFILE ]; then
67 stop
68 start
69 fi
70 ;;
71 *)
72 echo "Usage: $0 {start|stop|restart|condrestart|status}"
73 ;;
74 esac
75 exit $RETVAL

赋予可执行权限:

1 chmod +x /etc/init.d/mysql-mmm-monitor-navy2
2 chmod +x /etc/init.d/mysql-mmm-monitor-navy3

启动监控服务:

/etc/init.d/mysql-mmm-monitor-navy2 start
/etc/init.d/mysql-mmm-monitor-navy3 start

结果

 1 [root@monitor ~]# mmm_control  show
2 db1(172.28.26.101) master/ONLINE. Roles: writer(172.28.26.104)
3 db2(172.28.26.102) master/ONLINE. Roles:
4 db3(172.28.26.188) slave/ONLINE. Roles: reader(172.28.26.105)
5 db4(172.28.26.189) slave/ONLINE. Roles: reader(172.28.26.106)
6 [root@monitor ~]# mmm_control @navy2 show
7 db1(172.28.26.101) master/ONLINE. Roles: writer(172.28.26.107)
8 db2(172.28.26.102) master/ONLINE. Roles: reader(172.28.26.108)
9 [root@monitor ~]# mmm_control @navy3 show
10 db1(172.28.26.101) master/ONLINE. Roles: writer(172.28.26.109)
11 db2(172.28.26.102) master/ONLINE. Roles: reader(172.28.26.110)
12 [root@monitor ~]#

[转](多实例)mysql-mmm集群的更多相关文章

  1. 多图文,详细介绍mysql各个集群方案

    目录 多图文,详细介绍mysql各个集群方案 一,mysql原厂出品 二,mysql第三方优化 三,依托硬件配合 四,其它 多图文,详细介绍mysql各个集群方案 集群的好处 高可用性:故障检测及迁移 ...

  2. MySQL分布式集群之MyCAT(转)

    原文地址:http://blog.itpub.net/29510932/viewspace-1664499/ 隔了好久,才想起来更新博客,最近倒腾的数据库从Oracle换成了MySQL,研究了一段时间 ...

  3. MySQL Cluster 集群

    本文转载 http://www.cnblogs.com/gomysql/p/3664783.html MySQL Cluster是一个基于NDB Cluster存储引擎的完整的分布式数据库系统.不仅仅 ...

  4. 基于keepalived搭建MySQL热机集群

    背景 MySQL的高可用方案一般有如下几种: keepalived+双主,MHA,MMM,Heartbeat+DRBD,PXC,Galera Cluster 比较常用的是keepalived+双主,M ...

  5. MySQL分布式集群之MyCAT(一)简介【转】

    隔了好久,才想起来更新博客,最近倒腾的数据库从Oracle换成了MySQL,研究了一段时间,感觉社区版的MySQL在各个方面都逊色于Oracle,Oracle真的好方便!好了,不废话,这次准备记录一些 ...

  6. mysql各种集群的优缺点

    mysql各种集群的优缺点 1.主从架构:只是有数据备份的功能: 2.主主互备+keepalived:实现数据备份加高可用: 3.主主互备,主主下面分别挂个从: 4.A和B主主互备,把从库都挂到B下, ...

  7. 《综合》MMM集群

    <综合>MMM集群 部署集群基础环境 MySQL-MMM架构部署 MySQL-MMM架构使用 1 部署集群基础环境 1.1 问题 本案例要求为MySQL集群准备基础环境,完成以下任务操作: ...

  8. MySQL数据库集群进行正确配置步骤

    MySQL数据库集群进行正确配置步骤 2010-06-09 10:47 arrowcat 博客园 字号:T | T 我们今天是要和大家一起分享的是对MySQL数据库集群进行正确配置,我前两天在相关网站 ...

  9. Facebook揭密:如何让MySQL数据库集群自主运行

    Facebook运行着全球最大的MySQL数据库集群,该集群分布在两个大洲上的多个数据中心中数以千计的服务器上.让人不解的是,Facebook只动用了一个很小的团队来管理这个庞大的MySQL数据库集群 ...

  10. zookeeper的单实例和伪集群部署

    原文链接: http://gudaoyufu.com/?p=1395 zookeeper工作方式 ZooKeeper 是一个开源的分布式协调服务,由雅虎创建,是 Google Chubby 的开源实现 ...

随机推荐

  1. phonegap file操作

    phonegap中,有时候需要操作到手机中的文件,这个时候就需要用到phonegap官方提供的插件 file ,英文好的可以直接参考官方文档 首先是安装插件:(需要phonegap 3.0 以上,不止 ...

  2. Eclipse plugin插件开发 NoClassDefFoundError

    Eclipse的每一个plugin都有属于自己的类加载器,这是OSGI架构的基础,每一个plugin项目都是一个bundle,独立运行在各自的运行环境里面,这就造成了开发时和运行时的不同. Eclip ...

  3. Gitlab安装和使用相关信息

    Gitlab是利用 Ruby on Rails 一个开源的版本管理系统,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目.它拥有与Github类似的功能,能够浏览源代码,管理 ...

  4. 请求--拦截器--action经过

    引用我这里想知道的是同名的多个参数,会被自动的放置在List或者数组中,我想知道是怎么实现的,因为取一个参数和取多个同名的参数是不同的方法: 一个是request.getParameter 一个是re ...

  5. [转载]Spring Java Based Configuration

    @Configuration & @Bean Annotations Annotating a class with the @Configuration indicates that the ...

  6. LINUX下如何查看tomcat运行状态,判断其是否启动

    1,查看Tomcat启动日志. ${catalina_home}\logs [root@iZ25b4ffkfaZ logs]# tail -f catalina.outSep 10, 2015 11: ...

  7. hdu 4111 Alice and Bob 博弈论

    这里有2种方法: 方法一:求SG函数 sg[i][j]:i表示1的个数,j表示合并操作的步数. 这共有4种操作: 1.消除一个1: 2.减掉一个1: 3.合并2个1: 4.把1合并到另外不是1中. 代 ...

  8. Bash的脚本参数

    $0:脚本名字.此变量包含地址,可以使用basename $0获得脚本名称.$1:第一个参数$2,$3,$4,$5,…一次类推. $# 传递到脚本的参数个数$* 以一个单字符串显示所有向脚本传递的参数 ...

  9. Linux Shell 数字计算与比较

    直接上脚本, 使用$(())以及$[]进行数字计算 数值比较:n1 -eq n2检查n1是否等于n2         n1 -le n2检查n1是否小于等于n2n1 -ge n2检查n1是否大于等于n ...

  10. ios APP屏幕快照尺寸

    苹果上传APP审核需要上传APP屏幕快照,分别有3.5寸,4寸,4.7寸,5.5寸,ipad五种图片,对应尺寸大小: 3.5寸:横坚屏 640*960 或960*640 4寸:横坚屏 640*1036 ...