Skip to content

Instantly share code, notes, and snippets.

View liujingyu's full-sized avatar

jingyu liu liujingyu

View GitHub Profile

binlog 与redo log 区别

1、首先两者都是记录数据的改变,不同的是,binlog是记录所有数据的改变信息,而innodb的redo log只是记录所有innodb表数据的变化。

2、binlog是记录已经提交完毕之后的dml以及ddl sql语句,而innodb redo log是正在执行中的dml以及ddl语句

3、binlog可以作为恢复数据使用 redo log可以作为异常down机或者介质故障后的数据恢复使用

4、在db文件目录下,也分属于不通的日志文件中。

@liujingyu
liujingyu / PHP:str_after.md
Last active July 20, 2017 03:55
截取字符串的一部分返回

php strstr

<?php
$email  = 'name@example.com';
$domain = strstr($email, '@');
echo $domain; // prints @example.com
echo PHP_EOL;

$user = strstr($email, '@', true); // As of PHP 5.3.0
@liujingyu
liujingyu / MySQL:expire_logs_days.md
Last active August 1, 2017 09:20
MySQL 二进制日志删除处理

MySQL expire_logs_days 设置

说明:

当开启mysql数据库主从时,会产生大量如mysql-bin.00000* log的文件,这会大量耗费您的硬盘空间。

mysql-bin.000001
mysql-bin.000002
mysql-bin.000003

ubuntu:

$ wget https://www.percona.com/downloads/pmm-client/pmm-client-1.1.1/binary/debian/xenial/x86_64/pmm-client_1.1.1-1.xenial_amd64.deb

$ dpkg -i pmm-client_1.1.1-1.xenial_amd64.deb

centos:

@liujingyu
liujingyu / pmm-server.md
Created August 3, 2017 10:31
pmm-server docker搭建过程

pull images

docker pull percona/pmm-server

创建数据卷:

@liujingyu
liujingyu / pmm-admin.md
Created August 3, 2017 10:35
pmm-admin启动过程及Server添加
pmm-admin config --server 110.31.145.69 --server-user example --server-password example1234 --bind-address 110.45.40.204 --client-address 110.45.40.204 --client-name luka-online


pmm-admin add mysql --user root --password 123456 --host 110.45.40.204 --port 3306 example-3306
@liujingyu
liujingyu / docker-mysql.md
Last active August 4, 2017 02:41
mysql docker-compose
FROM mysql:5.7

#COPY etc/my.cnf /etc/

# Define mountable directories.

VOLUME ["/data"]

# Define working directory.
@liujingyu
liujingyu / emit.vue
Last active August 23, 2017 13:59
vue 小组件集合
this.$emit('change', { perpage: this.perpage, page: page })
@liujingyu
liujingyu / vimawesome.vim
Created September 3, 2017 03:44 — forked from junegunn/vimawesome.vim
Plugin completion using VimAwesome API
" ----------------------------------------------------------------------------
" vimawesome.com
" ----------------------------------------------------------------------------
function! VimAwesomeComplete() abort
let prefix = matchstr(strpart(getline('.'), 0, col('.') - 1), '[.a-zA-Z0-9_/-]*$')
echohl WarningMsg
echo 'Downloading plugin list from VimAwesome'
echohl None
ruby << EOF
require 'json'
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif