在nexus界面上可以手动上传release和hosted的包,但是无法手动上传snapshots的包

amd64的机器可以使用centos的MySQL5.7的镜像:https://hub.docker.com/r/centos/mysql-57-centos7/
arm64和amd64的机器也可以使用MySQL8.0的镜像:https://hub.docker.com/layers/library/mysql/8.0.29/images/sha256-44f98f4dd825a945d2a6a4b7b2f14127b5d07c5aaa07d9d232c2b58936fb76dc
启动MySQL5.7的容器
1 | docker run --name mysqltest -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7.44 |
启动MySQL8.0的容器
1 | docker run --name mysqltest -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8.0.29 |
如果想指定mysql配置和data挂载路径,可以先进入容器中将mysql的配置先拷贝出来
进入容器查看MySQL的配置路径
1 | sh-4.4# mysql --help | grep my.cnf |
参考:Docker安装MySQL 并挂载数据及配置文件,设置远程访问权限
将配置/etc/my.cnf拷贝到宿主机
1 | docker cp mysqltest:/etc/my.cnf /Users/lintong/Downloads/mysql8.0/config/ |
指定mysql配置和data挂载路径启动docker mysql
mysql8.0
1 | docker run --name mysqltest \ |
mysql5.7
1 | docker run --name mysqltest \ |
查看binlog是否开启,MySQL8.0默认是开启的
1 | mysql> show variables like '%log_bin%'; |
低版本默认是关闭的
如果是mysql5.7的话,需要在my.cnf配置中添加如下配置,参考:MySQL-开启binlog
1 | [mysqld]<br />log-bin=mysql-bin<br />server-id=1 |
其他配置
1 | #设置日志格式 |
可以在data目录下看到生成的binlog文件
使用命令查看binlog列表
1 | mysql> show binary logs; |
查看当前记录的binlog文件的文件名和偏移
1 | mysql> show master status; |
可以使用mysqlbinlog命令来查看binlog,如果想镜像中自带mysqlbinlog命令,可以使用debian的镜像,比如
1 | docker run --name mysqltest \ |
查看指定binlog文件的内容,可以看到这里先创建了一个test database,然后create了一张名为user的表
1 | mysql> show binlog events in 'mysql-bin.000005'; |
查看binlog的格式,binlog的格式有3种,分别为STATEMENT,ROW和MIXED
1 | mysql> SHOW VARIABLES LIKE '%binlog_format%'; |
可以使用mysqlbinlog命令将binlog导成sql文件
1 | mysqlbinlog --no-defaults --base64-output=decode-rows -v /var/lib/mysql/mysql-bin.000005 > /tmp/binlog005.sql |
也可以指定开始和结束时间来导出binlog,或者指定position
1 | mysqlbinlog --no-defaults --base64-output=decode-rows -v --start-datetime='2024-08-16 00:00:00' --stop-datetime='2024-08-16 23:00:00' /var/lib/mysql/mysql-bin.000005 > /tmp/binlog005.sql |
查看mysql的时区,可以看出使用的是UTC时间
1 | mysql> show variables like '%time_zone%'; |
task manager
参考:Flink重点难点:Flink任务综合调优(Checkpoint/反压/内存)
报错如下
1 | Caused by: java.lang.OutOfMemoryError: Direct buffer memory. The direct out-of-memory error has occurred. This can mean two things: either job(s) require(s) a larger size of JVM direct memory or there is a direct memory leak. <br />The direct memory can be allocated by user code or some of its dependencies. <br />In this case 'taskmanager.memory.task.off-heap.size' configuration option should be increased. Flink framework and its dependencies also consume the direct memory, mostly for network communication. <br />The most of network memory is managed by Flink and should not result in out-of-memory error. In certain special cases, in particular for jobs with high parallelism, the framework may require more direct memory which is not managed by Flink. <br />In this case 'taskmanager.memory.framework.off-heap.size' configuration option should be increased. If the error persists then there is probably a direct memory leak in user code or some of its dependencies which has to be investigated and fixed. The task executor has to be shutdown... |
可能需要调整的是taskmanager的内存参数, taskmanager.memory.task.off-heap.size 或者 taskmanager.memory.framework.off-heap.size,在启动flink session cluster的时候添加如下配置
需要注意的是,需要在启动session cluster的时候配置-D参数,在flink run的时候添加内存参数是无法生效的
1 | /usr/lib/flink/bin/yarn-session.sh -s 1 -jm 51200 -tm 51200 -qu data -D taskmanager.memory.task.off-heap.size=4G -D taskmanager.memory.framework.off-heap.size=4G --detached |
点到task manager的页面查看,配置的4G内存已经生效
这是由于flink off-heap size默认只有128M,需要进行调整,如下
参考:Flink 运行错误 java.lang.OutOfMemoryError: Direct buffer memory
其他调优:Flink性能调优
在flink cdc写hudi的场景下,建议使用BUCKET index type替换默认的FLINK STATE index type,FLINK STATE index type是in-memory的,十分消耗内存
引入joda-time
1 | <!--jodatime--> |
1.字符串转joda-time的DateTime
parse日期
1 | DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd"); |
parse时间戳
1 | DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); |
转换时区
1 | DateTimeFormatter format = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss yyyy").withLocale(Locale.ENGLISH); |
2.joda-time的DateTime转字符串
1 | String date = dt.toString("yyyy-MM-dd"); |
3.获取当前时间
1 | DateTime now = new DateTime(); |
4.比较2个DateTime的时间差
1 | Days.daysBetween(dateTime, now).getDays() > 7 |
5.jodatime添加时区
1 | DateTime now = new DateTime(DateTimeZone.UTC); |
泛型就是指在对象建立时不指定类中属性的具体类型,而由外部在声明及实例化对喜爱时指定类型。
在泛型的指定中无法指定基本数据类型的,必须设置成一个类,这样在设置一个数字时就必须使用包装类。
1 | class Point<T>{ //此处T可以是任意的标识符号,T是type的简称 |
多个线程要操作同一资源时就有可能出现资源的同步问题。
同步就是指多个操作在同一个时间段内只能有一个线程进行,其他线程要等待此线程完成之后才可以继续执行。
解决资源共享的同步操作,可以使用同步代码块和同步方法两种方式完成。
DAG参数含义
1 | https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/models/dag/index.html |
1.对于机型不同的机器,可以通过角色组来进行统一归类管理
比如对于HDFS组件,有的机型的磁盘为12块,有的机型的磁盘为16块,那么可以通过角色组将配置一致的机器分到一起
在HDFS组件下,选择实例