当前位置:网站首页>Flink和Spark中文乱码问题
Flink和Spark中文乱码问题
2022-08-05 05:14:00 【IT_xhf】
Flink中文乱码
近期开发Flink CDC 读取mysql数据写入到HDFS,发现写入中文乱码,排查了数据库编码和文件编码都没有问题,后来网上查了一些资料,修改flink.conf文件,新增如下内容
env.java.opts: -Dfile.encoding=UTF-8
Spark中文乱码
也排查了数据库编码和文件编码没有问题,在程序启动参数中新增–conf spark.executor.extraJavaOptions=“-Dfile.encoding=UTF-8” --conf spark.driver.extraJavaOptions=“-Dfile.encoding=UTF-8”
完整例子
spark-submit \
--master yarn \
--conf spark.executor.extraJavaOptions="-Dfile.encoding=UTF-8" \
--conf spark.driver.extraJavaOptions="-Dfile.encoding=UTF-8" \
--deploy-mode cluster \
--class com.vesoft.nebula.exchange.DBTest \
--driver-cores 1 \
--driver-memory 512M \
--num-executors 2 \
--executor-cores 2 \
--executor-memory 2G \
--queue default nebula-exchange_spark_2.4-3.0-SNAPSHOT.jar
或者在spark.conf中配置这两个参数
spark.executor.extraJavaOptions="-Dfile.encoding=UTF-8"
spark.driver.extraJavaOptions="-Dfile.encoding=UTF-8"
边栏推荐
猜你喜欢
OFDM Lecture 16 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems
flink实例开发-batch批处理实例
Flink EventTime和Watermarks案例分析
Using pip to install third-party libraries in Pycharm fails to install: "Non-zero exit code (2)" solution
【过一下4】09-10_经典网络解析
shell函数
CAP+BASE
vscode+pytorch use experience record (personal record + irregular update)
【过一下3】卷积&图像噪音&边缘&纹理
DOM and its applications
随机推荐
[Study Notes Dish Dog Learning C] Classic Written Exam Questions of Dynamic Memory Management
el-table鼠标移入表格改变显示背景色
Lecture 3 Gradient Tutorial Gradient Descent and Stochastic Gradient Descent
Flink EventTime和Watermarks案例分析
The difference between the operators and logical operators
NodeJs接收上传文件并自定义保存路径
CAP+BASE
flink基本原理及应用场景分析
coppercam primer [6]
Opencv中,imag=cv2.cvtColor(imag,cv2.COLOR_BGR2GRAY) 报错:error:!_src.empty() in function ‘cv::cvtColor‘
[Let's pass 14] A day in the study room
【过一下11】随机森林和特征工程
redis 持久化
Transformation 和 Action 常用算子
Database experiment five backup and recovery
学习总结week3_4类与对象
Error creating bean with name 'configDataContextRefresher' defined in class path resource
1.3 mysql batch insert data
周末作业-循环练习题(2)
Machine Learning (2) - Machine Learning Fundamentals