MySQL Fabric部署
架构描写叙述:
一台主机上安装4个MySQL 服务,当中一个MySQL服务用于存储MySQL Fabric后台数据;另外3个MySQL服务用于主从架构測试。一个主+两个从。
第一部分:二进制方式安装MySQL 5.6.19
1. 操作系统
CentOS release 6.2 (Final)
2. 创建用户和组
[root@mymaster1 ~]# groupadd mysql
[root@mymaster1 ~]# useradd -r -g mysqlmysql
3. 解压安装包(解压到你想存储数据库数据的地方)
[root@mymaster1 ~]# cd /data
[root@mymaster1 data]# tar -xzvf/root/mysql_soft/mysql-5.6.19-linux-glibc2.5-x86_64.tar.gz
[root@mymaster1 data]# ln -smysql-5.6.19-linux-glibc2.5-x86_64 mysql
4. 查看解压情况
[root@mymaster1 data]# ll
总用量 20
lrwxrwxrwx. 1 root root 34 6月 27 15:31 mysql -> mysql-5.6.19-linux-glibc2.5-x86_64
drwxr-xr-x. 13 rootroot 4096 6月 27 15:31 mysql-5.6.19-linux-glibc2.5-x86_64
5. 改动目录所属用户和组为mysql:
[root@mymaster1 data]# cd mysql
[root@mymaster1 mysql]# chown -R mysql:mysql.
6. 安装数据库
[root@mymaster1 mysql]#scripts/mysql_install_db --user=mysql --basedir=/data/mysql--datadir=/data/mysql/data
WARNING: The host'mymaster1.localdomain' could not be looked up with /data/mysql/bin/resolveip.
This probably means thatyour libc libraries are not 100 % compatible
with this binary MySQLversion. The MySQL daemon, mysqld, should work
normally with theexception that host name resolving will not work.
This means that youshould use IP addresses instead of hostnames
when specifying MySQLprivileges !
当出现上面警告时,解决方法是:在/etc/hosts配置文件里添加IP地址和主机名的映射
如
[root@mymaster1 Packages]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
IP地址 mymaster1.localdomain
正确的提示信息例如以下:
[root@mymaster1 mysql]#scripts/mysql_install_db --user=mysql --basedir=/data/mysql--datadir=/data/mysql/data
Installing MySQL system tables...2014-06-2716:02:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.Please use --explicit_defaults_for_timestamp server option (see documentationfor more details).
2014-06-27 16:02:45 2134 [Note] InnoDB:Using atomics to ref count buffer pool pages
2014-06-27 16:02:45 2134 [Note] InnoDB: TheInnoDB memory heap is disabled
2014-06-27 16:02:45 2134 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2014-06-27 16:02:45 2134 [Note] InnoDB:Compressed tables use zlib 1.2.3
2014-06-27 16:02:45 2134 [Note] InnoDB:Using Linux native AIO
2014-06-27 16:02:45 2134 [Note] InnoDB:Using CPU crc32 instructions
2014-06-27 16:02:45 2134 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2014-06-27 16:02:45 2134 [Note] InnoDB:Completed initialization of buffer pool
2014-06-27 16:02:45 2134 [Note] InnoDB: Thefirst specified data file ./ibdata1 did not exist: a new database to becreated!
2014-06-27 16:02:45 2134 [Note] InnoDB:Setting file ./ibdata1 size to 12 MB
2014-06-27 16:02:45 2134 [Note] InnoDB:Database physically writes the file full: wait...
2014-06-27 16:02:45 2134 [Note] InnoDB:Setting log file ./ib_logfile101 size to 48 MB
2014-06-27 16:02:46 2134 [Note] InnoDB:Setting log file ./ib_logfile1 size to 48 MB
2014-06-27 16:02:46 2134 [Note] InnoDB:Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-06-27 16:02:46 2134 [Warning] InnoDB:New log files created, LSN=45781
2014-06-27 16:02:46 2134 [Note] InnoDB:Doublewrite buffer not found: creating new
2014-06-27 16:02:46 2134 [Note] InnoDB:Doublewrite buffer created
2014-06-27 16:02:46 2134 [Note] InnoDB: 128rollback segment(s) are active.
2014-06-27 16:02:46 2134 [Warning] InnoDB:Creating foreign key constraint system tables.
2014-06-27 16:02:46 2134 [Note] InnoDB:Foreign key constraint system tables created
2014-06-27 16:02:46 2134 [Note] InnoDB:Creating tablespace and datafile system tables.
2014-06-27 16:02:46 2134 [Note] InnoDB:Tablespace and datafile system tables created.
2014-06-27 16:02:46 2134 [Note] InnoDB:Waiting for purge to start
2014-06-27 16:02:46 2134 [Note] InnoDB:5.6.19 started; log sequence number 0
2014-06-27 16:02:47 2134 [Note] Binlog end
2014-06-27 16:02:47 2134 [Note] InnoDB: FTSoptimize thread exiting.
2014-06-27 16:02:47 2134 [Note] InnoDB:Starting shutdown...
2014-06-27 16:02:48 2134 [Note] InnoDB:Shutdown completed; log sequence number 1625977
OK
Filling help tables...2014-06-27 16:02:48 0[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
2014-06-27 16:02:48 2157 [Note] InnoDB:Using atomics to ref count buffer pool pages
2014-06-27 16:02:48 2157 [Note] InnoDB: TheInnoDB memory heap is disabled
2014-06-27 16:02:48 2157 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins
2014-06-27 16:02:48 2157 [Note] InnoDB:Compressed tables use zlib 1.2.3
2014-06-27 16:02:48 2157 [Note] InnoDB:Using Linux native AIO
2014-06-27 16:02:48 2157 [Note] InnoDB:Using CPU crc32 instructions
2014-06-27 16:02:48 2157 [Note] InnoDB:Initializing buffer pool, size = 128.0M
2014-06-27 16:02:48 2157 [Note] InnoDB:Completed initialization of buffer pool
2014-06-27 16:02:48 2157 [Note] InnoDB:Highest supported file format is Barracuda.
2014-06-27 16:02:48 2157 [Note] InnoDB: 128rollback segment(s) are active.
2014-06-27 16:02:48 2157 [Note] InnoDB:Waiting for purge to start
2014-06-27 16:02:48 2157 [Note] InnoDB:5.6.19 started; log sequence number 1625977
2014-06-27 16:02:48 2157 [Note] Binlog end
2014-06-27 16:02:48 2157 [Note] InnoDB: FTSoptimize thread exiting.
2014-06-27 16:02:48 2157 [Note] InnoDB:Starting shutdown...
2014-06-27 16:02:50 2157 [Note] InnoDB:Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have tocopy
support-files/mysql.server to the rightplace for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !
To do so, start the server, then issue thefollowing commands:
/data/mysql/bin/mysqladmin -u root password 'new-password'
/data/mysql/bin/mysqladmin -u root -h mymaster1.localdomain password'new-password'
Alternatively you can run:
/data/mysql/bin/mysql_secure_installation
which will also give you the option ofremoving the test
databases and anonymous user created bydefault. This is
strongly recommended for productionservers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd. ; /data/mysql/bin/mysqld_safe &
You can test the MySQL daemon withmysql-test-run.pl
cdmysql-test ; perl mysql-test-run.pl
Please report any problems athttp://bugs.mysql.com/
The latest information about MySQL isavailable on the web at
http://www.mysql.com
Support MySQL by buying support/licenses athttp://shop.mysql.com
New default config file was created as/data/mysql/my.cnf and
will be used by default by the server whenyou start it.
You may edit this file to change serversettings
7. 改动相关文件夹权限,提高安全性:
[root@mymaster1 mysql]# chown -R root .
[root@mymaster1 mysql]# chown -R mysql data
8. 配置MySQL服务为主机服务,即能用service mysql start启动服务
[root@mymaster1 mysql]# cpsupport-files/mysql.server /etc/init.d/mysql
[root@mymaster1 mysql]# vi +46 /etc/init.d/mysql
把以下的
basedir=
datadir=
改动为
basedir=/data/mysql
datadir=/data/mysql/data
【备注】另外三个mysql服务。能够在这里复制为例如以下形式:
[root@mymaster1 mysql]#cp support-files/mysql.server /etc/init.d/mysql.3001
[root@mymaster1 mysql]#vi +46 /etc/init.d/mysql.3001
9. 改动配置文件
[root@mysqlfabric mysql_3001]# cd/opt/mysql
[root@mysqlfabric mysql]# vi my.cnf
改动对应的port号:
[mysqld]
character-set-server=gbk
lower_case_table_names=1
default_storage_engine=myisam
port=3306
gtid_mode=ON
log-bin
log-slave-updates
enforce-gtid-consistency
server_id=1 #【不同的MySQL服务,改动为不同的id】
【备注】:上面的蓝色字体是用于开启GTID复制參数
10. 启动数据库
[root@mymaster1 mysql]# service mysql start
Starting MySQL[确定]
11. 改动数据库rootpassword
[root@mymaster1 mysql]#/data/mysql/bin/mysqladmin -u root password 'root'
[root@mymaster1 mysql]#/data/mysql/bin/mysqladmin -u root -h mymaster1.localdomain password ' root'
12. 改动环境变量,把mysql运行文件路径加入到环境变量中
[root@mymaster1 mysql]# vi /etc/profile
PATH=$PATH:/data/mysql/bin
export PATH
13. 測试登录
[root@mymaster1 mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.19 MySQL CommunityServer (GPL)
Copyright (c) 2000, 2014, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
mysql>
mysql> show variables like '%data%';
+-------------------------------+------------------------+
| Variable_name | Value |
+-------------------------------+------------------------+
| character_set_database | latin1 |
| collation_database | latin1_swedish_ci |
| datadir | /data/mysql/data/
14. 加入用于复制的用户(3001上)
mysql> CREATE USER 'repl'@'%' IDENTIFIEDBY 'repl';
Query OK, 0 rows affected (0.03 sec)
mysql> GRANT REPLICATION SLAVE ON *.* TO'repl'@'%';
Query OK, 0 rows affected (0.00 sec)
15. 开启复制(3002,3003上)
使用change master to 命令开启复制
mysql> start slave;
mysql> show slave status\G
以下是重要步骤,安装Fabric
第二部分:安装MySQL Fabric
1. 安装Connector/Python
[root@mysqlfabric soft]# rpm -ivhmysql-connector-python-1.2.2-1.el6.noarch.rpm
注:MySQL Fabric使用Connector/Python来连接MySQL,所以必须安装这个连接器
2. 安装Fabric
因为Fabric包括在mysql-utilities,所以仅仅须要安装mysql-utilities就能够了。
[root@mysqlfabric soft]# rpm -ivh mysql-utilities-1.4.3-1.el6.noarch.rpm
Preparing... ########################################### [100%]
1:mysql-utilities ########################################### [100%]
3. 配置MySQL Fabric
配置MySQL Fabric须要创建MySQL用户,创建启动配置文件和安装Fabric数据存储
l 创建用户
登录port号为3306的mysql 服务【作为Fabric后台数据存储】
[root@mysqlfabric soft]# mysql -u root -P3306 -p –h mysqlfabric.localdomain
【注】上面登录时须要加主机名。由于一台server安装了多个mysql服务
mysql> CREATE USER 'fabric'@'mysqlfabric.localdomain'IDENTIFIED BY 'fabric';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON fabric.* TO'fabric'@'mysqlfabric.localdomain';
Query OK, 0 rows affected (0.00 sec)
l 在另外三台MySQL 服务下创建以下的用户。用于连接被管理的MySQL服务
[root@mysqlfabric mysql_3003]# mysql -uroot-P3001 -p -h mysqlfabric.localdomain
mysql> GRANT ALL ON *.* TO 'fabric'@' mysqlfabric.localdomain';
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR 'fabric'@' mysqlfabric.localdomain' = PASSWORD('fabric');
Query OK, 0 rows affected (0.00 sec)
[root@mysqlfabric mysql_3003]# mysql -uroot-P3002 -p -h mysqlfabric.localdomain
mysql> GRANT ALL ON *.* TO 'fabric'@' mysqlfabric.localdomain';
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR 'fabric'@' mysqlfabric.localdomain' = PASSWORD('fabric');
Query OK, 0 rows affected (0.00 sec)
[root@mysqlfabric mysql_3003]# mysql -uroot-P3003 -p -h mysqlfabric.localdomain
mysql> GRANT ALL ON *.* TO 'fabric'@' mysqlfabric.localdomain';
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR 'fabric'@' mysqlfabric.localdomain' = PASSWORD('fabric');
Query OK, 0 rows affected (0.00 sec)
l 配置文件
打开配置文件/etc/mysql/fabric.cfg
[root@mysqlfabric soft]# vi/etc/mysql/fabric.cfg
改动[storage]部分信息:
[storage]
auth_plugin = mysql_native_password
database = fabric
user = fabric
address = mysqlfabric.localdomain:3306
connection_delay = 1
connection_timeout = 6
password =fabric
connection_attempts = 6
[sharding]
mysqldump_program =/opt/mysql/bin/mysqldump
mysqlclient_program =/opt/mysql/bin/mysql
4. 填充MySQL Fabric后台存储数据(创建库和表)
[root@mysqlfabric mysql]# mysqlfabric manage setup--param=storage.user=fabric --param=storage.password=fabric
[INFO] 1404205520.480905 - MainThread -Initializing persister: user (fabric), server (mysqlfabric.localdomain:3306),database (fabric).
Finishing initial setup
=======================
Password for admin user is not yet set.
Password for admin/xmlrpc:
Repeat Password: admin
Password set.admin
5. 启动MySQL Fabric节点
[root@mysqlfabric ~]# mysqlfabric managestart
假设想在后台执行。能够加上—daemonize选项
停止方式:
[root@mysqlfabric ~]# mysqlfabric managestop
6. 配置MySQL Fabric用于主从复制
l 创建组
[root@mysqlfabric ~]# mysqlfabric groupcreate my_group
Password for admin:
Procedure :
{ uuid = d7d4581c-a819-47c2-ad31-37c5390e93bd,
finished = True,
success = True,
return = True,
activities =
}
l 把MySQL服务加入到组
错误信息:
[root@mysqlfabric ~]# mysqlfabric group addmy_group mysqlfabric.localdomain:3001
Procedure :
{ uuid = 5c373b82-d369-413d-a2e0-5b4c60d506c0,
finished = True,
success = False,
return = ServerError: Server (be642e20-00d3-11e4-8d96-0050568f7be4)does not have the binary log or gtid enabled.,
activities =
}
正确信息:
[root@mysqlfabric mysql_3003]# mysqlfabricgroup add my_group mysqlfabric.localdomain:3001
Procedure :
{ uuid = baafd4d2-dba8-4863-9a76-74a3e6153065,
finished = True,
success = True,
return = True,
activities =
}
[root@mysqlfabric mysql_3003]# mysqlfabric group add my_groupmysqlfabric.localdomain:3002
Procedure :
{ uuid = 2f336426-b12d-4bd2-ab71-0b6c9d513466,
finished = True,
success = True,
return = True,
activities =
}
[root@mysqlfabric mysql_3003]# mysqlfabric group add my_groupmysqlfabric.localdomain:3003
Procedure :
{ uuid = 844eba0a-a7bc-4e67-8359-3ab53d0520c7,
finished = True,
success = True,
return = True,
activities =
}
l 把组内一个MySQL服务提升为一个master:
加入MySQL服务到组后,Fabric不会意识到不论什么主从复制的架构。必须提升组内不论什么一个MySQL服务为主master,其他服务设置为slave。提升命令例如以下:
[root@mysqlfabric ~]# mysqlfabric grouppromote my_group
当组内有一个主master时,新加入到组内的新MySQL服务将自己主动成为slave。
也能够使用相同的命令使组内的master降级为slave。另选一个slave为master
l 查看my_group组Mysql服务的信息:
[root@mysqlfabric ~]# mysqlfabric grouplookup_servers my_group
Command :
{ success = True
return = [{'status':'SECONDARY', 'server_uuid': 'be642e20-00d3-11e4-8d96-0050568f7be4', 'mode':'READ_ONLY', 'weight': 1.0, 'address': 'mysqlfabric.localdomain:3001'},{'status': 'SECONDARY', 'server_uuid': 'c696a608-00d5-11e4-8da3-0050568f7be4','mode':
'READ_ONLY', 'weight': 1.0, 'address': 'mysqlfabric.localdomain:3002'},{'status': 'PRIMARY', 'server_uuid': '1230c8cb-00d7-11e4-8dac-0050568f7be4','mode': 'READ_WRITE', 'weight': 1.0, 'address':'mysqlfabric.localdomain:3003'}]
activities =
}
l 查看my_group组MySQL服务健康状态信息:
[root@mysqlfabric ~]# mysqlfabric grouphealth my_group
Command :
{ success = True
return ={'1230c8cb-00d7-11e4-8dac-0050568f7be4': {'status': 'PRIMARY', 'is_alive':True, 'threads': {}}, 'be642e20-00d3-11e4-8d96-0050568f7be4': {'status':'SECONDARY', 'is_alive': True, 'threads': {}},'c696a608-00d5-11e4-8da3-0050568f7be4': {'status':
'SECONDARY', 'is_alive':True, 'threads': {}}}
activities =
}
l 自己主动检測组内MySQL服务故障:
假设想在primary失败时。secondary能自己主动提升为primary,运行以下步骤:
[root@mysqlfabric ~]# mysqlfabric group activate my_group
Procedure :
{ uuid = 4ee1bd23-0fab-46f0-a336-9e4731117370,
finished = True,
success = True,
return = True,
activities =
}
【备注】假设不想让fabric自己主动检測故障,能够取消自己主动监控功能:
[root@mysqlfabric ~]# mysqlfabric group deactivate my_group
7. 故障測试
[root@mysqlfabric ~]# service mysql.3003 stop
[root@mysqlfabric ~]# mysqlfabric group lookup_servers my_group
Command :
{ success = True
return = [{'status':'SECONDARY', 'server_uuid': 'be642e20-00d3-11e4-8d96-0050568f7be4', 'mode':'READ_ONLY', 'weight': 1.0, 'address': 'mysqlfabric.localdomain:3001'},
{'status': 'PRIMARY', 'server_uuid':'c696a608-00d5-11e4-8da3-0050568f7be4', 'mode': 'READ_WRITE', 'weight': 1.0,'address': 'mysqlfabric.localdomain:3002'}, {'status': 'FAULTY','server_uuid': '1230c8cb-00d7-11e4-8dac-0050568f7be4',
'mode': 'READ_WRITE','weight': 1.0, 'address': 'mysqlfabric.localdomain:3003'}]
activities =
}
说明已经把3002提升为primary
8. Mysqlfabric相关命令:
l 把一个MySQL服务移出组:
mysqlfabric group remove my_groupserver_uuid
如:
[root@mysqlfabric ~]#mysqlfabric groupremove my_group 1230c8cb-00d7-11e4-8dac-0050568f7be4
master不能被移出组,必须disablemaster后才干够移出:
mysqlfabric group demote my_group
l 删除组(组内已经没有MySQL服务)
mysqlfabric group destroy my_group
l 强制删除组(组内有MySQL服务)
mysqlfabric group destroy my_group --force
奋斗的路很幸苦。部署到此介绍,再接再厉。
。。
。
MySQL Fabric部署的更多相关文章
- 甲骨文推出MySQL Fabric,简化MySQL的高可用性与可扩展性
北京,2014年5月28日——为了满足当下对Web及云应用需求,甲骨文宣布推出MySQL Fabric.MySQL Fabric是一款可简化管理MySQL数据库群的整合式系统.该产品通过故障检测和故障 ...
- Mysql Fabric实现学习笔记
Mysql Fabric用来管理mysql服务,提供扩展性和容易使用的系统,管理mysql分片和高可用部署(当前实现了两个特性:高可用和使用数据分片的横向扩展,能单独使用或结合使用这两个特性.). 架 ...
- MySQL Fabric和MyBatis的整合过程中遇到的问题
这是我昨天在整合MySQL Fabric和MyBatis时遇到的问题,花了大半天才解决的问题,解决的过程中在网上查找了很久,都没有找到解决的方案.现在记下来,希望能够帮助有同样问题的朋友.如果各位朋友 ...
- Ubuntu14.04 Django Mysql安装部署全过程
Ubuntu14.04 Django Mysql安装部署全过程 一.简要步骤.(阿里云Ubuntu14.04) Python安装 Django Mysql的安装与配置 记录一下我的部署过程,也方便 ...
- MySQL Fabric 分片性能测试
苦逼的人生,开始了新一轮调研.这次是上面要看 MySQL Fabric 分片性能,好吧,开搞. 1 啥是 MySQL Fabric 其实就是一个Python进程和应用端的Connector的组合.来一 ...
- 【转】Nginx+php-fpm+MySQL分离部署详解
转:http://www.linuxidc.com/Linux/2015-07/120580.htm Nginx+php-fpm+MySQL分离部署详解 [日期:2015-07-26] 来源:Linu ...
- MySQL安装部署
MySQL安装部署 使用自动化脚本
- 2-MySQL DBA笔记-MySQL安装部署和入门
第2章 MySQL安装部署和入门 第1章介绍了MySQL的一些基础知识,本章将为读者介绍MySQL的部署.安装及一些常用命令和参数的设置.2.1 如何选择MySQL版本 在选择MySQL的版本时,要根 ...
- Ubuntu常用命令大全 以及 PHP+MySQL代码部署在Linux(Ubuntu)上注意事项
PHP+MySQL代码部署在Linux(Ubuntu)上注意事项 https://cloud.tencent.com/developer/article/1024187 Ubuntu常用命令大全 ht ...
随机推荐
- [翻译] UIView-draggable 可拖拽的UIView
UIView-draggable 可拖拽的UIView https://github.com/andreamazz/UIView-draggable UIView category that adds ...
- web小流量实验方案
近期在思考怎么做小流量,在网上搜了一下,总结例如以下: 1.前提,站点pv已经达到了一定的规模,比方上百万pv,不做小流量冒然更新功能,可能会带来大面积流量损失.在这样的前提下须要做小流量实验 2.什 ...
- trident介绍
(一)理论基础 很多其它理论以后再补充,或者參考书籍 1.trident是什么? Trident is a high-level abstraction for doing realtime comp ...
- Zookeeper常用命令 (转)
原文链接:ZooKeeper系列之二:Zookeeper常用命令 ZooKeeper服务命令: 在准备好相应的配置之后,可以直接通过zkServer.sh 这个脚本进行服务的相关操作 1. 启动ZK服 ...
- 浅谈ASP.NET的Postback
说道ASP.NET的Postback,就得说Web Page的生命周期,但是Web Page的生命周期却不是三言两语就能够说得清楚的,所以在这里单纯站的编程的角度,撇开Web Page 的生命周期浅谈 ...
- 弹性方框模型 (Flexible Box Model) 快速入门
简介 我可以肯定,您对于页面上水平或垂直排列的样式元素已经了解得够多了.但是,CSS 还缺少适用于此任务的合适机制.了解 CSS3 弹性方框模型(简称 Flexbox) 该草案将 Flexbox 描述 ...
- C++实现委托机制(一)
1.引言: 如果你接触过C#,你就会觉得C#中的delegate(委托)十分灵巧,它的用法上和C\C++的函数指针很像,但是却又比C\C++的函数指针更加灵活.并且委托可以一对多,也就是可以注册多个函 ...
- PHP判断{函数/类/方法/属性}是否存在
1.php判断系统函数或自己写的函数是否存在 bool function_exists ( string $function_name ) 判断函数是否已经定义,例如: if(function_exi ...
- shiro 授权介绍
授权即访问控制,它将判断用户在应用程序中对资源是否拥有相应的访问权限.如,判断一个用户有查看页面的权限,编辑数据的权限,拥有某一按钮的权限,以及是否拥有打印的权限等等. 一.授权的三要素 授权有着三个 ...
- Android四大基本组件之 Activity
[Activity介绍] Activity 是用户接口程序,原则上它会提供给用户一个交互式的接口功能. 它是 android 应用程序的基本功能单元.Activity 本身是没有界面的.所以activ ...