tonglin0325的个人主页

Spark学习笔记——Spark加载jar包的过程

给spark任务添加jar包的方式

spark中使用的jar分成2种,一种是用户自行添加的jar,另一种是spark环境依赖的jar

1.spark环境依赖的jar

其添加的方式有有下面几种

1. --conf spark.driver.extraClassPath=... or --driver-class-path ...

2. --conf spark.driver.extraLibraryPath=..., or --driver-library-path ...

3. --conf spark.executor.extraClassPath=...

4. --conf spark.executor.extraLibraryPath=...

上面的配置参数指定的jar包最终都是放到了系统类加载器的classpath里,由系统类加载器完成加载。

 

2.用户自行添加的jar

其添加的方式有有下面几种

1. --jars

全文 >>

广告系统——第三方广告平台

罗列了一下第三方广告平台产品,按照广告的流程,分成4类:

DSP(广告需求方平台,广告主在上面进行投放)

ADX(广告交易平台,负责广告交易和竞价)

SSP(媒体供应方平台,媒体可以在上面售卖网站app的曝光来获得盈利)

DMP(为广告投放投放提供人群画像进行广告的受众定向,并进行人群标签画像的管理)

1.国内

1.BAT

2.字节快手

3.手机厂商

4.其他渠道

1.微博(DSP投放)

1
2
https://tui.weibo.com/home

微博的广告产品有超级粉丝通粉丝头条WAX(程序化广告交易平台)

360-搜索推广

全文 >>

Github博客接入谷歌广告AdSense

AdSense是Google GAM广告系统中的一个产品,可以在博客中接入Google AdSense来创造收入,下面是Google AdSense的官网

1
2
https://www.google.com/intl/zh-CN_cn/adsense/start/

 

1.注册AdSense账号

登录后会提示你没有AdSense账号,这时选择注册一个

2.填写信息

填写你的网站,并开始使用AdSense

进入Google AdSense页面,完善付款信息

 

3.给网站添加AdSense代码

点击获得代码

全文 >>

Ubuntu16.04安装presto

presto有2个社区,一个是PrestoDB(由Facebook员工维护,版本号是0.xxx),一个是PrestoSQL(由一些离开Facebook的Presto主力开发者维护,版本号是xxx,PrestoSQL 从版本 351 开始将其名称变更为 Trino)

社区版本 官网 安装包下载地址 版本号 安装文档
PrestoDB https://prestodb.io/ https://repo1.maven.org/maven2/com/facebook/presto/ 0.xxx(比如0.245) https://prestodb.io/docs/current/installation/deployment.html#installing-presto
PrestoSQL(Trino) https://trino.io/ https://repo1.maven.org/maven2/io/prestosql/ xxx(比如330) https://trino.io/docs/current/installation/deployment.html

PrestoSQL安装步骤

安装prestoSQL330

1.下载和安装

330是presto最后一个支持java8的版本,高于330的版本需要java11的支持,且java8的版本最低要8u161,否则会报下面错误:ERROR: Presto requires Java 11+ (found 1.8.0_121) 以及 ERROR: Presto requires Java 8u161+ (found 1.8.0_121)

1
2
3
wget https://repo1.maven.org/maven2/io/prestosql/presto-server/330/presto-server-330.tar.gz
tar -zxvf presto-server-330.tar.gz

创建presto用户

1
2
3
4
5
6
sudo groupadd presto
sudo useradd presto -g presto -r --no-log-init -d /var/lib/presto
sudo mkdir /var/lib/presto
sudo mv ~/software/presto-server-330 /opt/cloudera/parcels
sudo ln -s /opt/cloudera/parcels/presto-server-330 /opt/cloudera/parcels/presto

2.配置文件

在presto的安装目录下创建etc目录,以及若干配置文件

1
2
3
4
5
lintong@master:/opt/cloudera/parcels/presto$ ls
catalog config.properties jvm.config log.properties node.properties
lintong@master:/opt/cloudera/parcels/presto$ ls ./catalog/
jmx.properties

具体配置文件内容请参考上面表格中列出的presto安装文档

3.启动和停止

1
2
3
4
5
6
7
8
9
sudo -iu presto
$ cd /opt/cloudera/parcels/presto
$ ./bin/launcher status
Not running
$ ./bin/launcher start
Started as 14252
$ ./bin/launcher stop
Stopped 1425

全文 >>

在minikube下创建kafka集群

在minikube下安装的kafka集群分成4个步骤

1.在mac上安装minikube

这里安装的minikube是基于virtualbox的,也就是minikube是运行在virtualbox启动的一个虚拟机中

参考:Mac下安装minikube

2.给zk和kafka创建local persistence volumn

参考:Helm 安装Kafka

zk和kafka的数据需要落盘,所以需要依赖pv,这里创建的是k8s的local pv,注意如果volumeBindingMode选择WaitForFirstConsumer的话,只有在pod创建的时候,pvc才会绑定到pv上,没有pod就话pvc就一直是pending状态

StorageClass的yaml,local-storage.yaml

1
2
3
4
5
6
7
8
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: Immediate
reclaimPolicy: Retain

创建一个叫local-storage的StorageClass

1
2
kubectl apply -f ./local-storage.yaml

进入virtualbox的虚拟器中创建如下的linux目录,minikube的虚拟器账号密码是docker tcuser

全文 >>

K8S学习笔记——创建pv

在K8S上使用存储的时候,需要创建Persistence Volumes(持久化卷)用于持久化数据,否则当pod重启后,数据将会丢失,可以参考官方文档:

1
2
https://kubernetes.io/zh-cn/docs/concepts/storage/persistent-volumes/

常用的持久卷类型有local( 节点上挂载的本地存储设备),rbd(依赖Ceph,RBD 卷只能由单个使用者以读写模式安装。不允许同时写入),cephfs(依赖Ceph,同一 cephfs 卷可同时被多个写者挂载)等

1
2
https://kubernetes.io/zh-cn/docs/concepts/storage/volumes/

persistent volume,persistent volume claim和storage class的区别可以参考:Kubernetes对象之PersistentVolume,StorageClass和PersistentVolumeClaim

默认的storage class有HostPath,HostPath 卷 (仅供单节点测试使用;不适用于多节点集群; 请尝试使用 local 卷作为替代)

1
2
3
4
kubectl get sc -A
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
standard (default) k8s.io/minikube-hostpath Delete Immediate false 40d

如果要创建一个local的storage class,首先需要编写一个local-storage.yaml

1
2
3
4
5
6
7
8
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Retain

创建local sc

全文 >>

JavaScript学习笔记——基本知识

1.JavaScript的放置和注释

1.输出工具

A.alert();

B.document.write();

C.prompt(“”,””);

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>输出函数测试</title>
</head>

<body>
<script>
<!-- 弹出对话框显示 -->
alert("<h1>测试</h1>");

<!-- 页面显示 -->
document.write("<h1>测试教程</h1>");

<!-- 弹出输入对话框,一个提示参数,一个输入参数 -->
var value=prompt("please enter your name","")
<!-- 显示输入的参数 -->
alert(value);
</script>
</body>
</html>

测试教程

2.JavaScript如何在html页面当中进行放置

A.  放在中间,也可以放在中间,有两个属性,一个是type,另外一个是language

div中加样式:写class,,然后在中写

1
2
3
4
5
6
7
8
9
<style>
.one{
width:100px;
height:100px;
background:red;
font-size:12px;
color:blue;
}
</style>

JavaScript可以在html页面当中的任何位置来进行调用,但是他们还是一个整体,是相互联系,相互影响。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>javascript放置</title>
<script type="text/javascript" language="javascript" >
var a="这是测试"
</script>
<style>
.one{
width:100px;
height:100px;
background:red;
font-size:12px;
color:blue;
}
</style>
</head>

<body>

<script type="text/javascript" language="javascript">
a="这是测试demo"
document.write(a);
</script>


测试demo!


<script type="text/javascript" language="javascript">
alert(a);
</script>
</body>
</html>

B.可以在超链接或是重定向的位置调用javascript代码

格式:”javascript:alert(‘我是超链接’)”
重定向格式:action=”javascript:alert(‘我是表单’)”

全文 >>

Hive学习笔记——常用语法

1.查看表的列表

1
2
show tables

2.创建表

多个字段的时候需要指定用什么来分隔

1
2
3
create table test(id int,name string)row format delimited fields terminated by '\t';
create table test(id int,name string)row format delimited fields terminated by ',';

3.插入数据

1
2
insert into table test values (1,'row1'),(2,'row2');

也可以select任意一张空表来insert

1
2
insert into table default.example_table (select 1L,'xiaodou',array(1L,2L,3L) from default.test limit 1);

如果遇到 Unable to create temp file for insert values Expression of type TOK_FUNCTION not supported in insert/values

1
2
insert into table test partition(ds="2019-08-20") select 1L,2,1S,1.111,"test",2Y,true,array(1,2,3),array(1Y,1Y,1Y),map('name','Xiao','age','20'),map(10L,false,20L,true),"lin","tong";

4.加载数据

也可以使用Hadoop fs -put命令直接上传文件,注意文件中的分隔符需要和创建表的时候指定分隔符保持一致

1
2
load data local inpath 'XXXX' into table XXXX;

全文 >>

CSS学习笔记——基本写法

1.div+css网页标准布局

1.div

  1.DIV全称是division,意为“区块、分割”,DIV标签是一个无意义的容器标签,用于将页面划分出不同的区域

  2.通过DIV将复杂的页面进行细分块,可以将问题细分一个一个解决,所以通过DIV将页面分块是一个关键的工作,也是决定最终效果与质量的前提。

2.css

  CSS (Cascading Style Sheet),中文翻译为层叠样式表,是用于控制网页样式并允许将样式信息与网页内容分离的一种标记性语言。

3.div承载的是内容,而css承载的是样式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords"content=""/>
<meta name="description" content="本篇网页的概述,一段话,对网站的进一步描述"/>
<meta name="author" content="网页作者的资料">
<meta name="robots" content="" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style>
/*
body{
color:blue;
}
div{
font-size:15px;background:red;
}
*/
</style>
</head>

<body>

我是div

</body>
</html>&nbsp;

2.css写法

1.嵌入式css写法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<!-- 嵌入式css写法 -->
<style type="text/css">/*选择器*/
p{
color:red;
font-size: 30px;
}
span{
color:green;
font-size: 40px;
}
</style>

</head>

<body>

[百度]()
<br />

span标签

<p>今天是星期天</p>
<!-- 行内样式 -->
今天天气不错
</body>
</html>

2.引入样式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<!-- 引入样式 -->
<link rel="stylesheet" href="style.css" />


</head>

<body>



<p>今天是星期天</p>
<p>今天是星期天</p>
<p>今天是星期天</p>
<p>今天是星期天</p>
<p>今天是星期天</p>

</body>
</html>

CSS部分

1
2
3
4
5
6
7
8
9
10
11
12
13
/*导入样式*/
@import url('base.css');

p{
color:orange;
font-size: 50px;
}


span{
color:green;
font-size: 40px;
}

3.选择器

**当我们定义一条样式规则时候,这条样式规则会作用于网页当中的某些元素,而我们的规定的这些元素的规则就叫做选择器。  **

1.常用的选择器:

  1、id选择器  #idname

  2、类选择器  .classname

全文 >>

Cassandra学习笔记——基本概念

1.Cassandra介绍

Apache Cassandra是最流行的分布式宽表数据库,具有SQL的入口,最初由Facebook开发,后续贡献给Apache。参考:认识Cassandra

 

2.Partition Key, Composite Key和Clustering Columns

参考:Apache Cassandra Composite Key\Partition key\Clustering key 介绍

 

3.使用场景

用户的画像信息,订单信息,Feed流,IOT车联网的高并发写入场景等,由于Cassandra是OLTP数据库,所以可以很方便的支持增删改查,增加扩展字段。和其功能类似的还有HBase,ScyllaDB等。

参考:Cassandra全球使用的公司及场景

Cassandra 的过去、现在、未来(三)

 

4.性能

在同类数据库中排名第一

全文 >>