- 博客(19)
- 收藏
- 关注
原创 zookeeper client源码解析
1.首先是创建zookeeper实例zk = new ZooKeeper("192.168.0.170:2181", 5000, new zkDemo());下面是zk的构造函数public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher, boolean canBeReadOn...
2018-12-29 16:56:03 925
原创 zookeeper学习
ZNodesEvery node in a ZooKeeper tree is referred to as aznode. Znodes maintain a stat structure that includes version numbers for data changes, acl changes. The stat structure also has timestamps. ...
2018-12-29 11:40:40 397
原创 图形数据库neo4j的安装使用
1.安装ubutun:wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -echo 'deb https://debian.neo4j.org/repo stable/' | sudo tee /etc/apt/sources.list.d/neo4j.listsudo apt-g...
2018-12-28 18:45:25 468
原创 flink pojo流和tuple报错
报错:org.apache.flink.table.api.TableException: Only the first field can reference an atomic type. //流执行环境 StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment...
2018-12-26 17:29:17 3387 2
转载 centos crontab坑爹问题
手动在CentOS中执行sh脚本,调用java程序,一切正常;将该sh加入crontab中定时调度之后,挂了,完全没有执行到的感觉啊!!!查看crontab执行日志:cat /var/log/cron有执行记录,擦擦擦~~~难道用crontab调用执行会报错,打印日志先:crontab -e40 10 * * * /home/job.sh 2>>/home/...
2018-12-25 17:10:32 749
原创 python通过反射执行代码
场景:python2.7没有@注解 用于实现适配器模式,不能再方法执行前后维护一些全局变量。所以用反射的思路来统一调用一个方法来执行其他的函数。比如以下例子是为了维护一个长期使用的mysql连接,以此减少mysql的访问压力。在每次执行其他方法的时候调用self.conn = conn_app_db.check_conn(self.conn),以此来维护连接,或者产生新连接(通过conn....
2018-12-17 15:43:47 1398
原创 structuredstreaming需要注意的地方
structuredstreaming在版本1上增加了流式的dataset和df,但有很多原来的操作现在不能使用import org.apache.hadoop.util.ShutdownHookManagerimport org.apache.spark.sql.{ForeachWriter, Row, SparkSession}import org.apache.spark.sq...
2018-12-14 16:27:23 1868
转载 Structured Streaming 编程指南
概述Structured Streaming 是一个基于 Spark SQL 引擎的、可扩展的且支持容错的流处理引擎。你可以像表达静态数据上的批处理计算一样表达流计算。Spark SQL 引擎将随着流式数据的持续到达而持续运行,并不断更新结果。你可以在Scala,Java,Python或R中使用 Dataset/DataFrame API 来表示流聚合,事件时间窗口(event-time wi...
2018-12-13 16:15:39 1644 1
原创 spark状态stream统计uv(updateStateByKey)
import org.apache.spark.sql.SparkSessionimport org.apache.spark.streaming.{Seconds, StreamingContext}object KafkaUV { def main(args: Array[String]): Unit = { System.setProperty("hadoop.home....
2018-12-13 10:58:42 674
原创 spark使用window来统计近几分钟数据情况
package com.xyfimport org.apache.spark.SparkConfimport org.apache.spark.streaming.{Seconds, StreamingContext}object sparkStreamingTest { def main(args: Array[String]){ val conf = new Spar...
2018-12-12 15:09:26 1754
原创 sparkStreaming需要注意的
1.Window OperationsSpark Streaming also provides windowed computations, which allow you to apply transformations over a sliding window of data. The following figure illustrates this sliding window...
2018-12-12 11:21:04 229
原创 mysql使用用户变量解决窗口函数
需求:求行业底下关键词排名前五的数据SELECT industry,key_word,rate,new_rank as rank from (SELECT industry,key_word,rate,IF(@tmp=industry,@rank:=@rank + 1,@rank:=1) as new_rank,@tmp:=industry as tmp FROM `config_...
2018-12-11 11:09:48 344
转载 spark executor 相关
RDD在计算的时候,每个分区都会起一个task,所以rdd的分区数目决定了总的的task数目。申请的计算节点(Executor)数目和每个计算节点核数,决定了你同一时刻可以并行执行的task。比如的RDD有100个分区,那么计算的时候就会生成100个task,你的资源配置为10个计算节点,每个两2个核,同一时刻可以并行的task数目为20,计算这个RDD就需要5个轮次。如果计算资源不...
2018-12-10 17:54:09 182
原创 sparkSQL(版本2以后)
var spark = SparkSession.builder.master("local").appName("mytest").getOrCreate()//dataset -> rddvar dataset = spark.read.textFile("./test").cachevar result = dataset.rdd.map((a: String) => a...
2018-12-10 15:52:50 472
原创 hive查看锁表情况
Actually the table was locked with some queries. After unlocking the table, I am able to drop the table now.=>Query to unlock the tableunlock table <tablename>=>We can find the table...
2018-12-07 11:20:48 6201 1
原创 java使用spark时类型转换
mysparkTest2 my = new mysparkTest2();SparkSession spark = SparkSession. builder(). master( "local" ). appName( "mytest" ).getOrCreate();Dataset<String> logData = spar...
2018-12-06 19:02:50 1186
原创 scala使用impilct参数
class StringIterator(s: String) extends AbsIterator { type T = Char private var i = 0 def hasNext = i < s.length def next() = { val ch = s charAt i i += 1 ch } object Stri...
2018-12-06 14:17:47 108
原创 TOUR OF SCALA 通过混入(MIXIN)来组合类
当某个特质被用于组合类时,被称为混入。abstract class A { val message: String}class B extends A { val message = "I'm an instance of class B"}trait C extends A { def loudMessage = message.toUpperCase()}clas...
2018-12-05 17:00:42 140
原创 mimtproxy+python3.6
https://github.com/ring04h/wyproxy1.上面链接是python2.7姐和mimtproxy做代理的,下面将使用python3.6开启mimtproxy服务(1)开启mimtproxy服务from mitmproxy.master import Masterfrom mitmproxy.proxy import configfrom mitmpr...
2018-12-02 16:55:54 1614 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人