当前位置:网站首页>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"
边栏推荐
- Flink Table API 和 SQL之概述
- My 的第一篇博客!!!
- 【过一下6】机器视觉视频 【过一下2被挤掉了】
- "PHP8 Beginner's Guide" A brief introduction to PHP
- [Software Exam System Architect] Software Architecture Design ③ Domain-Specific Software Architecture (DSSA)
- RDD和DataFrame和Dataset
- day11-函数作业
- Lecture 2 Linear Model Linear Model
- 学习总结week2_5
- Difference between for..in and for..of
猜你喜欢
随机推荐
Detailed Explanation of Redis Sentinel Mode Configuration File
redis复制机制
redis 缓存清除策略
实现跨域的几种方式
Flink HA安装配置实战
鼠标放上去变成销售效果
Machine Learning (2) - Machine Learning Fundamentals
【技能】长期更新
Error creating bean with name 'configDataContextRefresher' defined in class path resource
HQL statement execution process
机器学习(二) —— 机器学习基础
ES6基础语法
What field type of MySQL database table has the largest storage length?
【过一下15】学习 lstm的一周
pycharm中调用Matlab配置:No module named ‘matlab.engine‘; ‘matlab‘ is not a package
flink中文文档-目录v1.4
学习总结week2_5
redis事务
vscode要安装的插件
Flink accumulator Counter 累加器 和 计数器