选择机制中的概念
服务器ID
比如有三台服务器,编号分别是1,2,3。
编号越大在选择算法中的权重越大。
数据ID(或事务ID)
服务器中存放的最大数据ID.
值越大说明数据越新,在选举算法中数据越新权重越大。
逻辑时钟
BigData
zookeeper, 性能优化, 集群
Word Count: 1.2k(words)
Read Count: 4(minutes)
之前有翻译过一系列Grafana配置Graphite的文章。传送门
在用过Prometheus之后,发现Prometheus配合Grafana也是天造的一对,以设的一双。
对于服务器基础指标监控而言,Prometheus通过node_exporter来收集数据做为数据源,提供了各种与硬件和内核相关的详细指标。
下面分享一个我正在使用的Ansible Playbook,用于批量部署node_exporter到多个目标主机。
DevOps
Ansible, Monitor, Playbook, Prometheus
Word Count: 362(words)
Read Count: 1(minutes)
首先,我们对比一下foreachPartition和foreach两个方法的实现,有什么不同的地方:
1 2 3 4 5 6 7 8 9
| def foreach(f: T => Unit): Unit = withScope { val cleanF = sc.clean(f) sc.runJob(this, (iter: Iterator[T]) => iter.foreach(cleanF)) }
def foreachPartition(f: Iterator[T] => Unit): Unit = withScope { val cleanF = sc.clean(f) sc.runJob(this, (iter: Iterator[T]) => cleanF(iter)) }
|
BigData
Spark, 性能优化
Word Count: 851(words)
Read Count: 3(minutes)
DevOps
Flume, Kafka
Word Count: 535(words)
Read Count: 1(minutes)
在处理第11行读文件时,由于数据文件出现的不规律,在指定日期内可能存在日志文件不存在的情况,这里需要处理下异常:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| def readLog(sc: SparkContext, startDate: String, endDate: String, logNames: List[String]): RDD[String] = { val dateLst = DateUtils.getDateListBetweenTwoDate(startDate, endDate)
var logRdd = sc.makeRDD(List[String]()) for (date <- dateLst) { val year = date.substring(0, 4) val month = date.substring(4, 6) val day = date.substring(6, 8) for (logName <- logNames) { val logRdd = logRdd.union( try {sc.textFile(s"cosn://fuge/mid-data/fuge/ssp/bid-log/$year/$month/$day/${logName}*") .map(x => x.split("\\|", -1)) .filter(x => x.length >= 2 && (x(1).trim == "6" || x(1).trim == "0")).map(_.toString) } catch { case _: Exception => sc.makeRDD(List[String]()) } ) } } logRdd }
|
Coding
Exception, Scala
Word Count: 312(words)
Read Count: 1(minutes)
宣称打破美国垄断、自主研发出国产浏览器内核的红芯浏览器,却被质疑使用的是谷歌Chrome内核,而且是两年前的旧版内核(详细剖析可参考:融资2.5亿的国产浏览器之光,竟然只是谷歌浏览器换了层皮?
Opinions
Shame, 红芯浏览器
Word Count: 407(words)
Read Count: 1(minutes)
supervise_redis_sleep 长时间卡死
解决方案:
1、按住CTRL+C强制结束;
2、运行:sudo systemctl restart gitlab-runsvdir;
3、再次执行:sudo gitlab-ctl reconfigure
Issues
Gitlab, Issue
Word Count: 228(words)
Read Count: 1(minutes)
客户的网站上的监测代码最近连续两次在网站更新时被清除掉,导致无法正常获取网站访问数据,影响到后续大数据分析。
为解决这个问题,决定使用Python Selenium模块来实现网站按钮模拟点击,同时监测我们后台是否能正常收到,以此来判断网站按钮监测代码是否有正常部署。
Selenium很好用很强大,开发和部署也都很简单,是自动化测试非常好的工具,但是问题是我们需要在无GUI的服务器上进行部署,这就牵涉到在无GUI的服务器上安装浏览器的问题,我这里选择的是Chrome。
下面简单分享一个部署过程中遇到的坑,也当作是总结。
Python
Chromium, Selenium
Word Count: 806(words)
Read Count: 3(minutes)
V’s speech is recognized by the analysts at Smith Change the World Incorporated as one of the most influential speeches of the near future.
Voice
V
Word Count: 1k(words)
Read Count: 6(minutes)
BigData
BigData, Hadoop
Word Count: 436(words)
Read Count: 1(minutes)