当前位置:网站首页>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"
边栏推荐
- [Go through 4] 09-10_Classic network analysis
- 有用番茄来监督自己的同道中人吗?加一下我的自习室,一起加油
- 【过一下 17】pytorch 改写 keras
- 【记一下1】2022年6月29日 哥和弟 双重痛苦
- 学习总结week3_2函数进阶
- 02.01-----The role of parameter reference "&"
- 【过一下14】自习室的一天
- Flink Distributed Cache 分布式缓存
- Multi-threaded query results, add List collection
- Community Sharing|Tencent Overseas Games builds game security operation capabilities based on JumpServer
猜你喜欢
随机推荐
序列基础练习题
02.01-----参数的引用的作用“ & ”
redis cache clearing strategy
day7-列表作业(1)
Do you use tomatoes to supervise your peers?Add my study room, come on together
【过一下16】回顾一下七月
【过一下7】全连接神经网络视频第一节的笔记
redis persistence
NodeJs接收上传文件并自定义保存路径
My 的第一篇博客!!!
数据库 单表查询
Pycharm中使用pip安装第三方库安装失败:“Non-zero exit code (2)“的解决方法
解决端口占用问题
Mysql5.7 二进制 部署
CAP+BASE
DOM及其应用
数据库实验五 备份与恢复
02.01-----The role of parameter reference "&"
Machine Learning (2) - Machine Learning Fundamentals
What field type of MySQL database table has the largest storage length?








