【转载】MySQL和Keepalived高可用双主复制
服务器主机IP和虚拟浮动IP配置
- RealServer A 192.168.75.133
- RealServer B 192.168.75.134
- VIP A 192.168.75.110
- VIP B 192.168.75.111
安装KeepAlived软件包
- [root@mysql-b ~]# yum install keepalived
- ================================================================================
- Package Arch Version Repository Size
- ================================================================================
- Installing:
- keepalived i686 1.2.7-3.el6 base 170 k
- Installing for dependencies:
- libnl i686 1.1.4-2.el6 base 124 k
- lm_sensors-libs i686 3.1.1-17.el6 base 37 k
- net-snmp-libs i686 1:5.5-49.el6_5.1 updates 1.5 M
- perl i686 4:5.10.1-136.el6 base 9.7 M
- perl-Module-Pluggable i686 1:3.90-136.el6 base 40 k
- perl-Pod-Escapes i686 1:1.04-136.el6 base 32 k
- perl-Pod-Simple i686 1:3.13-136.el6 base 212 k
- perl-libs i686 4:5.10.1-136.el6 base 593 k
- perl-version i686 3:0.77-136.el6 base 51 k
- Transaction Summary
- ================================================================================
- Install 10 Package(s)
查看RPM包的文件路径
- [root@mysql-a ~]# rpm -lq keepalived
- /etc/keepalived
- /etc/keepalived/keepalived.conf
- /etc/rc.d/init.d/keepalived
- /etc/sysconfig/keepalived
- /usr/bin/genhash
- /usr/sbin/keepalived
- /usr/share/doc/keepalived-1.2.7
- /usr/share/doc/keepalived-1.2.7/AUTHOR
- /usr/share/doc/keepalived-1.2.7/CONTRIBUTORS
- /usr/share/doc/keepalived-1.2.7/COPYING
- /usr/share/doc/keepalived-1.2.7/ChangeLog
- /usr/share/doc/keepalived-1.2.7/README
- /usr/share/doc/keepalived-1.2.7/TODO
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.HTTP_GET.port
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.IPv6
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.SMTP_CHECK
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.SSL_GET
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.SYNOPSIS
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.fwmark
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.inhibit
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.misc_check
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.misc_check_arg
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.quorum
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.sample
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.status_code
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.track_interface
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.virtual_server_group
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.virtualhost
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.localcheck
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.lvs_syncd
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.routes
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.scripts
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.static_ipaddress
- /usr/share/doc/keepalived-1.2.7/keepalived.conf.vrrp.sync
- /usr/share/man/man1/genhash.1.gz
- /usr/share/man/man5/keepalived.conf.5.gz
- /usr/share/man/man8/keepalived.8.gz
- /usr/share/snmp/mibs/KEEPALIVED-MIB.txt
- [root@mysql-a ~]#
KeepAlived双主RealServer A配置
! Configuration File for keepalived
global_defs {
notification_email {
acassen@firewall.loc
failover@firewall.loc
sysadmin@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
#192.168.200.16
#192.168.200.17
#192.168.200.18
192.168.75.110
}
}
vrrp_instance VI_2 {
state BACKUP
interface eth0
virtual_router_id 52
priority 50
advert_int 1
authentication {
auth_type PASS
auth_pass 2222
}
virtual_ipaddress {
#192.168.200.16
#192.168.200.17
#192.168.200.18
192.168.75.111
}
}
KeepAlived双主RealServer B配置
! Configuration File for keepalived
global_defs {
notification_email {
acassen@firewall.loc
failover@firewall.loc
sysadmin@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 50
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
#192.168.200.16
#192.168.200.17
#192.168.200.18
192.168.75.110
}
}
vrrp_instance VI_2 {
state MASTER
interface eth0
virtual_router_id 52
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 2222
}
virtual_ipaddress {
#192.168.200.16
#192.168.200.17
#192.168.200.18
192.168.75.111
}
}
在RealServer B上启动KeepAlived服务
[root@mysql-b keepalived]# chkconfig –list keepalived
keepalived 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@mysql-b keepalived]# chkconfig –level 35 keepalived on
[root@mysql-b keepalived]# service keepalived start
Starting keepalived: [ OK ]
[root@mysql-b keepalived]#
查看两个Virtual IP信息
[root@mysql-b keepalived]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:7c:b3:f2 brd ff:ff:ff:ff:ff:ff
inet 192.168.75.134/24 brd 192.168.75.255 scope global eth0
inet 192.168.75.110/32 scope global eth0
inet 192.168.75.111/32 scope global eth0
inet6 fe80::20c:29ff:fe7c:b3f2/64 scope link
valid_lft forever preferred_lft forever
[root@mysql-b keepalived]#
在RealServer A上启动KeepAlived服务后查看Virtual IP信息
[root@mysql-a keepalived]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:13:94:f0 brd ff:ff:ff:ff:ff:ff
inet 192.168.75.133/24 brd 192.168.75.255 scope global eth0
inet 192.168.75.110/32 scope global eth0
inet6 fe80::20c:29ff:fe13:94f0/64 scope link
valid_lft forever preferred_lft forever
[root@mysql-a keepalived]#
在RealServer B上再次查看Virtual IP信息
[root@mysql-b keepalived]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:7c:b3:f2 brd ff:ff:ff:ff:ff:ff
inet 192.168.75.134/24 brd 192.168.75.255 scope global eth0
inet 192.168.75.111/32 scope global eth0
inet6 fe80::20c:29ff:fe7c:b3f2/64 scope link
valid_lft forever preferred_lft forever
[root@mysql-b keepalived]#
————————–MySQL
[root@mysql-a ~]# yum install mysql-server mysql
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mysql i686 5.1.73-3.el6_5 updates 903 k
mysql-server i686 5.1.73-3.el6_5 updates 8.8 M
Installing for dependencies:
perl-DBD-MySQL i686 4.013-3.el6 base 134 k
perl-DBI i686 1.609-4.el6 base 705 k
Transaction Summary
================================================================================
Install 4 Package(s)
[root@mysql-a ~]# /usr/bin/mysqladmin -u root password ‘mysqlpass’
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
server-id=1
log-bin=mysql-bin
binlog-ignore-db=mysql
binlog_format=mixed
expire_logs_days=7
sync_binlog=1
auto_increment_offset=1
auto_increment_increment=2
log_slave_updates
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
—————————
server-id=2
log-bin=mysql-bin
binlog-ignore-db=mysql
binlog_format=mixed
expire_logs_days=7
sync_binlog=1
auto_increment_offset=2
auto_increment_increment=2
log_slave_updates
———————————–
添加复制用户并授权
A
mysql> grant replication slave on *.* to repl@’192.168.75.134′ identified by ‘replpasswd’;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
B
mysql> grant replication slave on *.* to repl@’192.168.75.133′ identified by ‘replpasswd’;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
—————-
锁定表为只读状态,并查看二进制日志的当前位置信息
A
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)
mysql> show master status;
+——————+———-+————–+——————+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+——————+———-+————–+——————+
| mysql-bin.000001 | 348 | | mysql |
+——————+———-+————–+——————+
1 row in set (0.00 sec)
B
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)
mysql> show master status;
+——————+———-+————–+——————+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+——————+———-+————–+——————+
| mysql-bin.000003 | 491 | | mysql |
+——————+———-+————–+——————+
1 row in set (0.00 sec)
——————-
各自指定对方为master主机的连接配置信息和位置信息
A
mysql> change master to master_host=’192.168.75.134′,master_user=’repl’,master_password=’replpasswd’,master_log_file=’mysql-bin.000003′,master_log_pos=491;
Query OK, 0 rows affected (0.03 sec)
mysql>
B
mysql> change master to master_host=’192.168.75.133′,master_user=’repl’,master_password=’replpasswd’,master_log_file=’mysql-bin.000001′,master_log_pos=348;
Query OK, 0 rows affected (0.03 sec)
mysql>
————–
解除表锁定,分别启动Slave并查看复制运行状态
A
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.75.134
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 491
Relay_Log_File: mysqld-relay-bin.000002
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 491
Relay_Log_Space: 407
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
ERROR:
No query specified
mysql>
B
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.75.133
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 348
Relay_Log_File: mysqld-relay-bin.000002
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 348
Relay_Log_Space: 407
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
ERROR:
No query specified
mysql>
[root@mysql-a ~]# netstat -nt |grep 3306
tcp 0 0 192.168.75.133:3306 192.168.75.134:36244 ESTABLISHED
tcp 0 0 192.168.75.133:60121 192.168.75.134:3306 ESTABLISHED
[root@mysql-a ~]#
[root@mysql-b keepalived]# netstat -nt |grep 3306
tcp 0 0 192.168.75.134:3306 192.168.75.133:60121 ESTABLISHED
tcp 0 0 192.168.75.134:36244 192.168.75.133:3306 ESTABLISHED
[root@mysql-b keepalived]#
———————–
测试:
A
mysql> create database aaa;
Query OK, 1 row affected (0.00 sec)
mysql>
B
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| aaa |
| mysql |
| test |
+——————–+
4 rows in set (0.00 sec)
mysql> create database bbb;
Query OK, 1 row affected (0.00 sec)
mysql>
A
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| aaa |
| bbb |
| mysql |
| test |
+——————–+
5 rows in set (0.01 sec)
mysql>
——————–
VIP测试
A
mysql> create database ccc;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on ccc.* to cccuser@’%’;
Query OK, 0 rows affected (0.00 sec)
mysql> set password for cccuser@’%’=password(‘cccpwd’);
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql>
VIP 192.168.75.110
[root@localhost ~]# mysql -u cccuser -pcccpwd -h 192.168.75.110
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.73-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> use ccc;
Database changed
mysql> create table list (id int(4) not null primary key auto_increment,
-> name char(20) not null,
-> address char(40) not null);
Query OK, 0 rows affected (0.01 sec)
mysql> show tables;
+—————+
| Tables_in_ccc |
+—————+
| list |
+—————+
1 row in set (0.00 sec)
mysql> quit
Bye
[root@localhost ~]#
VIP 192.168.75.111
[root@localhost ~]# mysql -u cccuser -pcccpwd -h 192.168.75.111
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.73-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> use ccc;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+—————+
| Tables_in_ccc |
+—————+
| list |
+—————+
1 row in set (0.00 sec)
mysql> quit
Bye
[root@localhost ~]#
————————-
关闭RealServer B 测试KeepAlived VIP可用性和数据库连接
[root@localhost ~]# mysql -u cccuser -pcccpwd -h 192.168.75.110
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.1.73-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> quit
Bye
[root@localhost ~]# mysql -u cccuser -pcccpwd -h 192.168.75.111
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.1.73-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> quit
Bye
[root@localhost ~]#
在RealServer B关闭情况下的ping测试
[root@localhost ~]# ping -c 4 192.168.75.110
PING 192.168.75.110 (192.168.75.110) 56(84) bytes of data.
64 bytes from 192.168.75.110: icmp_seq=1 ttl=64 time=0.535 ms
64 bytes from 192.168.75.110: icmp_seq=2 ttl=64 time=0.312 ms
64 bytes from 192.168.75.110: icmp_seq=3 ttl=64 time=0.351 ms
64 bytes from 192.168.75.110: icmp_seq=4 ttl=64 time=0.356 ms
— 192.168.75.110 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.312/0.388/0.535/0.088 ms
[root@localhost ~]# ping -c 4 192.168.75.111
PING 192.168.75.111 (192.168.75.111) 56(84) bytes of data.
64 bytes from 192.168.75.111: icmp_seq=1 ttl=64 time=0.572 ms
64 bytes from 192.168.75.111: icmp_seq=2 ttl=64 time=0.301 ms
64 bytes from 192.168.75.111: icmp_seq=3 ttl=64 time=0.452 ms
64 bytes from 192.168.75.111: icmp_seq=4 ttl=64 time=0.293 ms
— 192.168.75.111 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 0.293/0.404/0.572/0.117 ms
[root@localhost ~]#
原文地址:http://www.linuxcache.com/archives/2831
转载请注明原文地址
【转载】MySQL和Keepalived高可用双主复制的更多相关文章
- Nginx+keepalived(高可用双主模式)
Nginx+keepalived(高可用双主模式) tips:前面已经介绍了nginx+keepalived高可用主从模式,今天补充下高可用的双主模式,均可以作为主机使用 server1:192.16 ...
- MySQL的keepalived高可用监控脚本
MySQL的keepalived高可用监控脚本 MySQL(或者其它服务)的keepalived高可用监控脚本 开发脚本需求 :我们知道,keepalive是基于虚拟ip的存活来判断是否抢占maste ...
- [Mysql高可用]——双主互备+keepalived
实验架构图 实验环境 主机名 操作系统 Mysql版本 keepalived版本 主机IP VIP lyj1(Master/Slave) Red Hat release 6.5 Mysql5.6 ...
- 暑假打工 2 个 月,让我明白了 Keepalived 高可用的三种路由方案
暑假打工 2 个 月,让我明白了 Keepalived 高可用的三种路由方案 这是悟空的第 158 篇原创文章 原文链接:首发悟空聊架构 官网:www.passjava.cn 你好,我是悟空. 前言 ...
- keepalived+mysql双主复制高可用方案
MySQL双主复制,即互为Master-Slave(只有一个Master提供写操作),可以实现数据库服务器的热备,但是一个Master宕机后不能实现动态切换.而Keepalived通过虚拟IP,实现了 ...
- MySQL集群搭建(6)-双主+keepalived高可用
双主 + keepalived 是一个比较简单的 MySQL 高可用架构,适用于中小 MySQL 集群,今天就说说怎么用 keepalived 做 MySQL 的高可用. 1 概述 1.1 keepa ...
- nginx+keepalived高可用及双主模式
高可用有2中方式. 1.Nginx+keepalived 主从配置 这种方案,使用一个vip地址,前端使用2台机器,一台做主,一台做备,但同时只有一台机器工作,另一台备份机器在主机器不出现故障的时候, ...
- 基于Keepalived实现LVS双主高可用集群
Reference: https://mp.weixin.qq.com/s?src=3×tamp=1512896424&ver=1&signature=L1C7us ...
- nginx+keepalived高可用及双主模式【h】
高可用有2中方式. 1.Nginx+keepalived 主从配置 这种方案,使用一个vip地址,前端使用2台机器,一台做主,一台做备,但同时只有一台机器工作,另一台备份机器在主机器不出现故障的时候, ...
随机推荐
- Python 标准库 —— glob
glob库是最简单的模块之一,内容非常少.用它可以查找符合特定规则的文件路径名.跟使用 windows 下的文件搜索差不多.查找文件只用到三个匹配符: "*", 匹配 0 个或多个 ...
- Arcengine 实现要素选取的方法(转载)
转自原文Arcengine 实现要素选取的方法(转载) 选择一个要素或者一个要素集(FeatureSelection)的方法很多,如IMap::SelectByShape.ILayer::search ...
- [TypeScript] Create random integers in a given range
Learn how to create random integers using JavaScript / TypeScript. /** * Returns a random int betwee ...
- js进阶 11-12 jquery如何实现节点的删除和复制
js进阶 11-12 jquery如何实现节点的删除和复制 一.总结 一句话总结:remove().detach().empty()方法 1.jquery删除节点中的remove()方法和detac ...
- Django项目开发实例之我的博客
1.开发环境 2.创建virtualenv 3.安装相关包 Django Pillow 4.创建项目 添加应用: 5.设置静态文件和模板 6.运行测试 参考(http://www.cnblogs.co ...
- [Ramda] Declaratively Map Data Transformations to Object Properties Using Ramda evolve
We don't always control the data we need in our applications, and that means we often find ourselves ...
- sql中group by用来干嘛的
sql中group by用来干嘛的 一.总结 一句话总结: 1.group by用来分类汇总的,by后面接要分的类 2.group by既然是分类汇总,那就要和聚合函数结合使用,因为要汇总啊 3.ha ...
- ARM汇编初探---汇编代码中都有哪几类指令---ARM伪指令介绍
要学习一个东西首先要把概念搞清楚,以下仅仅是自己的一些关于汇编的理解. 可运行文件里的01码是机器码,机器码不等于汇编码,尽管机器码能够非常easy翻译成汇编码. 汇编码中包括非常多汇编指令.伪指令和 ...
- freemarker自己定义标签(一)
freemarker自己定义标签 1.自己定义标签说明 宏变量存储模板片段能够被用作自己定义指令macro 2.演示样例说明 <html> <head> <meta ht ...
- lucene 7.x 查询
@Test public void indexSearch() throws IOException, ParseException { //Termquery:精确string查询 // Query ...