`
BucketLi
  • 浏览: 190078 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
博客专栏
5a76a659-f8e6-3bf3-b39a-8ae8f7a0f9d9
Percolator与分布...
浏览量:5551
社区版块
存档分类
最新评论
文章列表
#! /usr/bin/python import sys,MySQLdb max_pk=-1; max_gmt_create='2017-11-07 9:33:15'; record_count=0; last_gmt_create=max_gmt_create; while 1: db = MySQLdb.connect('127.0.0.1','sysbench_test','abc','abc') cursor = db.cursor() try: sql="sql" cursor.execute(sq ...
Grafana(https://github.com/grafana/grafana)是一个开源并支持多种metrics存储源的监控工具,DRDS(https://www.aliyun.com/product/drds)是阿里云商用的分布式数据库中间件,虽然有蛮多限制,但是底下基于MySQL,并且分库分表是比较成熟的方案,比较适合前台落数据业务使用,DRDS 的`show full stats`指令提供了秒级监控,所以马上想到用grafana来快速搭建一个针对DRDS的秒级监控。 废话不多说,开始步骤,注意:本文不考虑安全因素,如果生产使用,请设置好账号密码,以及权限,云上请注意设置ip白名单 ...
1. mysql.server stop 2. xxx/mysqld_safe --skip-grant-tables & 3. mysql -uroot 4. mysql> update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost'; 5. flush privileges; 6. mysql.server start
主要用来做ORACLE到MySQL的结构迁移。 #! /usr/bin/env python import cx_Oracle def get_ora_conn(ip, port ,sid, user, password): dsn = cx_Oracle.makedsn(ip, port, sid) conn = cx_Oracle.connect(user, password, dsn) return conn def test(): conn = get_ora_conn("127.0.0.1", 1521, ...

RAFT协议学习

paper可以从https://raft.github.io/这里下载 这篇文章对于几个比较难理解的特殊情况解释得比较清楚:https://my.oschina.net/pingpangkuangmo/blog/776714 其中安全里面“当前term的leader不能直接提交之前term的entries” 这个点比较难理解,上面这篇文章解释清楚了 和raft比较类似的zookeeper实现的一致性协议zab协议在下面这篇文章中做了详细说明:https://my.oschina.net/pingpangkuangmo/blog/778927 但是zab和raft还是存在很大的不同,综合看来r ...
  // Step 1 Find the source tables for which the subscriber has access         // privileges. rs = stmt.executeQuery("SELECT * FROM ALL_SOURCE_TABLES"); sources = new ArrayList<OracleCDCSource>(); while (rs.next()) { String srcS ...
每种event的详细情况参见 http://dev.mysql.com/doc/internals/en/binlog-event-type.html 引用 +==========================+ | event    | timestamp         0 : 4         | | header +------------------------------+ |              | type_code         4 : 1         | |             +------------------------------+ |     ...
默认mysqldump命令会将指定库的某个表数据变成一整个batch insert语句,非常大,而且性能也不意味着最好,琢磨了一段时间的mysqldump参数,发现 --net_buffer_length  这个参数能够控制一个batch insert 的大小,这样问题就能解决。 比较常用的mysqldump命令格式: mysqldump -h {host} -u {user} -p{password} --compact --complete-insert --no-create-info --net_buffer_length=4096 {database} {table}

一段shell的tips

#! /bin/sh if [ -f test.sql ];then rm -f test.sql fi touch test.sql for (( i=0;i<1000;i++)) do mc='insert into t_user(user_name,user_number) values ' for (( j=0;j<1000;j++)) do num=$((15500000000+$i*1000+j)) name=$i"t"$j if [ $j != 999 ];th ...
更加简便的方式 1. 购买一个墙外服务器 2. 做免密:  ssh-copy-id root@1.1.1.1 3. 本地做一个端口,并转发 nohup ssh -qTfnN -D 888888 root@1.1.1.1 vmstat 10 >/dev/null 2>&1 & 4. 浏览器装 SwitchyOmega ,填写 127.0.0.1 和第三步开的端口 ------------- 之前一直买VPN,不过最近各种封,看上去似乎自己搭建一个会稍微好点,折腾了几个小时,有一点小折腾,不过最后搞定。这边tips下。 买的是阿里云美西服务器(到期后试试 ...
有1个机器上load比较高,需要排查下是什么原因造成的,这边记录下排查过程。 1. top 先看下机器总体状况,其中cpu sy 占用大概到90%,us,wa等指标都很低,说明系统中存在大量的线程切换。 2. 然后top中看到一个java进程占用cpu 100%以上,基本上定位到该进程可能存在问题。 3. ps -Lf pid  查看该java进程的各线程资源占用比,发现有两个线程占用cpu比较明显,将这两个线程线程号转成16进制备用 4. jstack pid > stack 将该java进程的线程栈dump出来,grep 上一个步骤准备好的线程号,找到对应代码 5. 最后发现 ...
[mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the b ...

shell使用tips

shell for循环 引用for m in `cat m.md`;do echo $m;done shell互操作 引用echo choice:$'\n' 1.a $'\n' 2.b $'\n' 3.b;read x;echo $x 查文件并且处理 引用find /home/admin/logs/ -iname error.log | xargs cat 引用find /home/admin/data2/zkLog/version-2 -mtime +3|xargs rm -f {} awk值的条件判定,并打印 引用cat /tmp/xxx | awk -F, '{source=subs ...

软件使用tip

1.git on windows Filenames too long mac上新做了一个项目,win7上想继续搞,不料报这个异常,主要是一个node_modules依赖文件夹层次太深,简单查了下原因可能调用了git调用了较老的win7 api.stackoverflow了下.git config --system core.longpaths true 执行下就解决了,对git client有个>=1.9.0版本的要求.
知乎上看到一个技术管理的帖子(原文地址:http://www.zhihu.com/question/30093712 ,月影的回答),这里收藏下 做技术和做管理这两种角色有什么不一样? 暂且抛开技能层面的东西不说,我认为要成为优秀的技术人员,最重要的是要知 ...
Global site tag (gtag.js) - Google Analytics