5小时玩转阿里云实时计算Flink实时湖仓之代码文档

news2024/11/20 13:24:12

文章目录

    • 视频链接
  • bxg代码文档
    • 项目离线数据准备
    • MySQL映射表
    • 流数据准备
      • num.txt
      • makedata.log(空文件)
      • start.sh
      • create-log.sh
      • insert-data.sh
    • 维表
      • 创建paimon_dim表
      • mysql_to_paimon_dim任务
    • 事实表
      • ODS层
        • ECS创建ods层kafka topic
        • kafka_ods表
        • mysql_to_kafka_ods数据插入
        • paimon_ods表
        • kafka_ods_to_paimon_ods
    • 附录
      • 组件安装

视频链接

第二章:基于Flink CDC数据采集

bxg代码文档

项目离线数据准备

  • mysql
create database if not exists bxg character set utf8;
create database if not exists bxg_1 character set utf8;
  • 运行脚本bxg.sql,bxg1.sql

MySQL映射表

create database if not exists mysql;
DROP TABLE IF EXISTS mysql.mysql_oe_stu_course_order;
CREATE TABLE if not exists mysql.mysql_oe_stu_course_order
(
    `id`                INT,
    `student_course_id` INT,
    `order_id`          STRING,
    `order_detail_id`   STRING,
    `create_time`       TIMESTAMP(3),
    `update_time`       TIMESTAMP(3),
    `delete_flag`       BOOLEAN,
    PRIMARY KEY (`id`) NOT ENFORCED
) WITH (
    'connector' = 'mysql',
    'hostname' = 'rm-2ze047w59ovk9299x.rwlb.rds.aliyuncs.com',
    'port' = '3306',
    'username' = 'itcast',
    'password' = 'Itcast123',
    'database-name' = 'bxg',
    'table-name' = 'oe_stu_course_order'
);
CREATE TABLE if not exists mysql.mysql_oe_stu_course
(
    `id`               INT,
    `student_id`       STRING,
    `course_id`        INT,
    `status`           TINYINT,
    `contract_status`  TINYINT,
    `learn_status`     TINYINT,
    `service_days`     SMALLINT,
    `service_expires`  TIMESTAMP(3),
    `validity_days`    INT,
    `validity_expires` TIMESTAMP(3),
    `terminate_cause`  TINYINT,
    `effective_date`   TIMESTAMP(3),
    `finished_time`    TIMESTAMP(3),
    `total_progress`   DECIMAL(10, 2),
    `purchase_time`    INT,
    `create_time`      TIMESTAMP(3),
    `update_time`      TIMESTAMP(3),
    `delete_flag`      BOOLEAN,
    PRIMARY KEY (`id`) NOT ENFORCED
) WITH (
    'connector' = 'mysql',
    'hostname' = 'rm-2ze047w59ovk9299x.rwlb.rds.aliyuncs.com',
    'port' = '3306',
    'username' = 'itcast',
    'password' = 'Itcast123',
    'database-name' = 'bxg',
    'table-name' = 'oe_stu_course'
);
CREATE TABLE if not exists mysql.mysql_oe_order
(
    `id`                    STRING,
    `channel`               STRING,
    `student_id`            STRING,
    `order_no`              STRING,
    `total_amount`          DECIMAL(10, 2),
    `discount_amount`       DECIMAL(10, 2),
    `charge_against_amount` DECIMAL(10, 2),
    `payable_amount`        DECIMAL(10, 2),
    `status`                TINYINT,
    `pay_status`            TINYINT,
    `pay_time`              TIMESTAMP(3),
    `paid_amount`           DECIMAL(10, 2),
    `effective_date`        TIMESTAMP(3),
    `terminal`              TINYINT,
    `refund_status`         TINYINT,
    `refund_amount`         DECIMAL(10, 2),
    `refund_time`           TIMESTAMP(3),
    `create_time`           TIMESTAMP(3),
    `update_time`           TIMESTAMP(3),
    `delete_flag`           BOOLEAN,
    PRIMARY KEY (id) NOT ENFORCED
) WITH (    
    'connector' = 'mysql',
    'hostname' = 'rm-2ze047w59ovk9299x.rwlb.rds.aliyuncs.com',
    'port' = '3306',
    'username' = 'itcast',
    'password' = 'Itcast123',
    'database-name' = 'bxg',
    'table-name' = 'oe_order'
);
CREATE TABLE if not exists mysql.mysql_oe_course
(
    `id`                        INT,
    `grade_name`                STRING,
    `bigimg_path`               STRING,
    `video_url`                 STRING,
    `img_alt`                   STRING,
    `description`               STRING,
    `detailimg_path`            STRING,
    `smallimg_path`             STRING,
    `sort`                      INT,
    `status`                    STRING,
    `learnd_count`              INT,
    `learnd_count_flag`         INT,
    `original_cost`             DECIMAL(10, 2),
    `current_price`             DECIMAL(10, 2),
    `course_length`             DECIMAL(10, 2),
    `menu_id`                   INT,
    `is_free`                   BOOLEAN,
    `course_detail`             STRING,
    `course_detail_mobile`      STRING,
    `course_detail1`            STRING,
    `course_detail1_mobile`     STRING,
    `course_plan_detail`        STRING,
    `course_plan_detail_mobile` STRING,
    `course_detail2`            STRING,
    `course_detail2_mobile`     STRING,
    `course_outline`            STRING,
    `common_problem`            STRING,
    `common_problem_mobile`     STRING,
    `lecturer_id`               INT,
    `is_recommend`              INT,
    `recommend_sort`            INT,
    `qqno`                      STRING,
    `description_show`          INT,
    `rec_img_path`              STRING,
    `pv`                        INT,
    `course_type`               INT,
    `default_student_count`     INT,
    `study_status`              INT,
    `online_course`             INT,
    `course_level`              INT,
    `content_type`              INT,
    `recommend_type`            INT,
    `employment_rate`           STRING,
    `employment_salary`         STRING,
    `score`                     STRING,
    `cover_url`                 STRING,
    `offline_course_url`        STRING,
    `outline_url`               STRING,
    `project_page_url`          STRING,
    `preschool_test_flag`       BOOLEAN,
    `service_period`            INT,
    `included_validity_period`  TINYINT,
    `validity_period`           INT,
    `qualified_jobs`            STRING,
    `work_year_min`             INT,
    `work_year_max`             INT,
    `promote_flag`              BOOLEAN,
    `create_person`             STRING,
    `update_person`             STRING,
    `create_time`               TIMESTAMP(3),
    `update_time`               TIMESTAMP(3),
    `is_delete`                 BOOLEAN,
    PRIMARY KEY (`id`) NOT ENFORCED
) WITH (    
    'connector' = 'mysql',
    'hostname' = 'rm-2ze047w59ovk9299x.rwlb.rds.aliyuncs.com',
    'port' = '3306',
    'username' = 'itcast',
    'password' = 'Itcast123',
    'database-name' = 'bxg',
    'table-name' = 'oe_course'
);

流数据准备

num.txt

1

makedata.log(空文件)


start.sh

#!/bin/bash

echo "开始时间:`date '+%Y-%m-%d %H:%M:%S'`"
echo "大概时间:`expr $2 \* 60`秒"
nohup sh ./create-log.sh $@ > makedata.log 2>&1 &

tail -f makedata.log

create-log.sh

#!/bin/bash
echo "执行流数据写入脚本,10s后开启流数据写入!"
sleep 10
step=$1
total=`expr $2 \* 60`
echo "1" > /root/sql/num.txt
num=$(cat num.txt)
for ((i=0;i<total;i=(i+step)));do
    sh ./insert-data.sh $num $@
    num=`expr $num + 1`
    echo $num > num.txt
    sleep $step
done
exit 0

insert-data.sh

#!/bin/bash

num=$1

oe_stu_course_order="
replace into bxg.oe_stu_course_order
select id,
       student_course_id,
       order_id,
       order_detail_id,
       timestampadd(second, timestampdiff(second, update_time, now()), create_time) as create_time,
       now()                                                                        as update_time,
       delete_flag
from bxg_1.oe_stu_course_order
where rn = ${num}
;
"

oe_stu_course="
replace into bxg.oe_stu_course
select id,
       student_id,
       course_id,
       status,
       contract_status,
       learn_status,
       service_days,
       timestampadd(second, timestampdiff(second, update_time, now()), service_expires) as service_expires,
       validity_days,
       timestampadd(second, timestampdiff(second, update_time, now()), validity_expires) as validity_expires,
       terminate_cause,
       timestampadd(second, timestampdiff(second, update_time, now()), effective_date) as effective_date,
       timestampadd(second, timestampdiff(second, update_time, now()), finished_time) as finished_time,
       total_progress,
       purchase_time,
       timestampadd(second, timestampdiff(second, update_time, now()), create_time) as create_time,
       now()                                                                        as update_time,
       delete_flag
from bxg_1.oe_stu_course
where rn = ${num}
;
"

oe_order="
replace into bxg.oe_order
select id,
       channel,
       student_id,
       order_no,
       total_amount,
       discount_amount,
       charge_against_amount,
       payable_amount,
       status,
       pay_status,
       timestampadd(second, timestampdiff(second, update_time, now()), pay_time)       as pay_time,
       paid_amount,
       timestampadd(second, timestampdiff(second, update_time, now()), effective_date) as effective_date,
       terminal,
       refund_status,
       refund_amount,
       timestampadd(second, timestampdiff(second, update_time, now()), refund_time)    as refund_time,
       timestampadd(second, timestampdiff(second, update_time, now()), create_time)    as create_time,
       now()                                                                           as update_time,
       delete_flag
from bxg_1.oe_order
where rn = ${num}
;
"

i=1
for argument in $@
do
    if [ $i -ge 4 ];then
        case $argument in
            "oe_stu_course_order")
              sql=$oe_stu_course_order
              ;;
            "oe_stu_course")
              sql=$oe_stu_course
              ;;
            "oe_order")
              sql=$oe_order
              ;;
            "all")
              sql=$oe_stu_course_order$oe_stu_course$oe_order
              ;;
        esac
        echo $sql
        mysql --host=rm-2ze047w59ovk9299x.rwlb.rds.aliyuncs.com --port=3306 --user=itcast  --password=Itcast123 --database=bxg -e"${sql}"
    fi
    i=`expr $i + 1`
done

维表

创建paimon_dim表

  • 在dev作业中建库
create database if not exists paimon.dim;
CREATE TABLE if not exists paimon.dim.dim_oe_course
(
    `id`                        INT,
    `grade_name`                STRING,
    `bigimg_path`               STRING,
    `video_url`                 STRING,
    `img_alt`                   STRING,
    `description`               STRING,
    `detailimg_path`            STRING,
    `smallimg_path`             STRING,
    `sort`                      INT,
    `status`                    STRING,
    `learnd_count`              INT,
    `learnd_count_flag`         INT,
    `original_cost`             DECIMAL(10, 2),
    `current_price`             DECIMAL(10, 2),
    `course_length`             DECIMAL(10, 2),
    `menu_id`                   INT,
    `is_free`                   BOOLEAN,
    `course_detail`             STRING,
    `course_detail_mobile`      STRING,
    `course_detail1`            STRING,
    `course_detail1_mobile`     STRING,
    `course_plan_detail`        STRING,
    `course_plan_detail_mobile` STRING,
    `course_detail2`            STRING,
    `course_detail2_mobile`     STRING,
    `course_outline`            STRING,
    `common_problem`            STRING,
    `common_problem_mobile`     STRING,
    `lecturer_id`               INT,
    `is_recommend`              INT,
    `recommend_sort`            INT,
    `qqno`                      STRING,
    `description_show`          INT,
    `rec_img_path`              STRING,
    `pv`                        INT,
    `course_type`               INT,
    `default_student_count`     INT,
    `study_status`              INT,
    `online_course`             INT,
    `course_level`              INT,
    `content_type`              INT,
    `recommend_type`            INT,
    `employment_rate`           STRING,
    `employment_salary`         STRING,
    `score`                     STRING,
    `cover_url`                 STRING,
    `offline_course_url`        STRING,
    `outline_url`               STRING,
    `project_page_url`          STRING,
    `preschool_test_flag`       BOOLEAN,
    `service_period`            INT,
    `included_validity_period`  INT,
    `validity_period`           INT,
    `qualified_jobs`            STRING,
    `work_year_min`             INT,
    `work_year_max`             INT,
    `promote_flag`              BOOLEAN,
    `create_person`             STRING,
    `update_person`             STRING,
    `create_time`               TIMESTAMP(3),
    `update_time`               TIMESTAMP(3),
    `is_delete`                 BOOLEAN,
    PRIMARY KEY (id) NOT ENFORCED
);

mysql_to_paimon_dim任务

  • 在mysql_to_paimon_dim作业中配置作业,数据插入
insert into paimon.dim.dim_oe_course
select * from mysql.mysql_oe_course;

事实表

ODS层

Kafka启动

cd /export/server/kafka/bin/
./kafka-server-start.sh -daemon ../config/server.properties

ECS创建ods层kafka topic

kafka-topics.sh --create --topic ods_oe_order --bootstrap-server 172.16.10.106:9092 
kafka-topics.sh --create --topic ods_oe_stu_course --bootstrap-server 172.16.10.106:9092 
kafka-topics.sh --create --topic ods_oe_stu_course_order --bootstrap-server 172.16.10.106:9092 

kafka_ods表

在dev作业中建库,建表

create database if not exists dw;
CREATE TABLE if not exists dw.kafka_ods_oe_stu_course_order
(
    `id`                INT,
    `student_course_id` INT,
    `order_id`          STRING,
    `order_detail_id`   STRING,
    `create_time`       TIMESTAMP(3),
    `update_time`       TIMESTAMP(3),
    `delete_flag`       BOOLEAN,
    proctime as proctime(),
    PRIMARY KEY (id) NOT ENFORCED
) WITH (  
    'connector' = 'upsert-kafka',  
    'topic' = 'ods_oe_stu_course_order',  
    'properties.bootstrap.servers' = '172.16.10.106:9092',  
    'key.format' = 'json',  
    'value.format' = 'json'
);
CREATE TABLE if not exists dw.kafka_ods_oe_stu_course
(
    `id`               INT,
    `student_id`       STRING,
    `course_id`        INT,
    `status`           INT,
    `contract_status`  INT,
    `learn_status`     INT,
    `service_days`     INT,
    `service_expires`  TIMESTAMP(3),
    `validity_days`    INT,
    `validity_expires` TIMESTAMP(3),
    `terminate_cause`  INT,
    `effective_date`   TIMESTAMP(3),
    `finished_time`    TIMESTAMP(3),
    `total_progress`   DECIMAL(10, 2),
    `purchase_time`    INT,
    `create_time`      TIMESTAMP(3),
    `update_time`      TIMESTAMP(3),
    `delete_flag`      BOOLEAN,
    proctime as proctime(),
    PRIMARY KEY (id) NOT ENFORCED
) WITH (  
    'connector' = 'upsert-kafka',  
    'topic' = 'ods_oe_stu_course',  
    'properties.bootstrap.servers' = '172.16.10.106:9092',  
    'key.format' = 'json',  
    'value.format' = 'json'
);
CREATE TABLE if not exists dw.kafka_ods_oe_order
(
    `id`                    STRING,
    `channel`               STRING,
    `student_id`            STRING,
    `order_no`              STRING,
    `total_amount`          DECIMAL(10, 2),
    `discount_amount`       DECIMAL(10, 2),
    `charge_against_amount` DECIMAL(10, 2),
    `payable_amount`        DECIMAL(10, 2),
    `status`                INT,
    `pay_status`            INT,
    `pay_time`              TIMESTAMP(3),
    `paid_amount`           DECIMAL(10, 2),
    `effective_date`        TIMESTAMP(3),
    `terminal`              INT,
    `refund_status`         INT,
    `refund_amount`         DECIMAL(10, 2),
    `refund_time`           TIMESTAMP(3),
    `create_time`           TIMESTAMP(3),
    `update_time`           TIMESTAMP(3),
    `delete_flag`           BOOLEAN,
    proctime as proctime(),
    PRIMARY KEY (id) NOT ENFORCED
) WITH (  
    'connector' = 'upsert-kafka',  
    'topic' = 'ods_oe_order',  
    'properties.bootstrap.servers' = '172.16.10.106:9092',  
    'key.format' = 'json',  
    'value.format' = 'json'
);

mysql_to_kafka_ods数据插入

  • 创建mysql_to_kafka_ods作业草稿
BEGIN STATEMENT SET;
insert into dw.kafka_ods_oe_stu_course_order
select *
from mysql.mysql_oe_stu_course_order
-- /*+ OPTIONS('scan.startup.mode' ='latest-offset') */
;

insert into dw.kafka_ods_oe_stu_course
select *
from mysql.mysql_oe_stu_course
-- /*+ OPTIONS('scan.startup.mode' ='latest-offset') */
;

insert into dw.kafka_ods_oe_order
select *
from mysql.mysql_oe_order
-- /*+ OPTIONS('scan.startup.mode' ='latest-offset') */
;
END;

查看Topic的数据

kafka-console-consumer.sh --bootstrap-server 172.16.10.106:9092 --topic ods_oe_order --from-beginning 

删除Topic

kafka-topics.sh --delete --topic ods_oe_order --bootstrap-server 172.16.10.106:9092
kafka-topics.sh --delete --topic ods_oe_stu_course --bootstrap-server 172.16.10.106:9092
kafka-topics.sh --delete --topic ods_oe_stu_course_order --bootstrap-server 172.16.10.106:9092

验证kafka_ods层的数据量:

select count(*) from dw.kafka_ods_oe_order;

和RDS的MySQL的bxg.oe_order表的条数一致即可。

关于Flink资源不足的处理方案:

image-20230816162520055

解决方案:将Task Managers 数量调整为2或者以上,也可以将TaskManager的Cpu cores设置更大一些

Task Managers 数量原来是1,由于数据量大带来的计算量大一些,需要调大一些,这里修改为2或以上

关于ECS内存不足的处理方案:

由于免费资源领取ecs服务器1核2g内存,所以运行组件较多的时候,建议重启ecs云服务器在开启服务

重启ECS:
1、关闭Flink作业运维中的作业
2、重启ECS,可以在控制台关闭,可以init 6
重启后的相关组件重启:
1、启动Zookpeer
cd /export/server/zookeeper/bin/
./zkServer.sh start  
2、启动Kafka服务
cd /export/server/kafka/bin/
./kafka-server-start.sh -daemon ../config/server.properties
3、查看进程jps
4、重新开启Flink作业中作业运维中的作业
5、重新查询对应Kafka_ods层的数据

paimon_ods表

create database if not exists paimon.ods;

CREATE TABLE if not exists paimon.ods.paimon_ods_oe_stu_course_order (
    `id` INT,
    `student_course_id` INT,
    `order_id` STRING,
    `order_detail_id` STRING,
    `create_time` TIMESTAMP(3),
    `update_time` TIMESTAMP(3),
    `delete_flag` BOOLEAN,
    `proctime` timestamp,
     dt string comment '日期',
   PRIMARY KEY (id,dt) NOT ENFORCED
)  partitioned by (dt)
;

CREATE TABLE if not exists paimon.ods.paimon_ods_oe_stu_course (
    `id` INT,
    `student_id` STRING,
    `course_id` INT,
    `status` INT,
    `contract_status` INT,
    `learn_status` INT,
    `service_days` INT,
    `service_expires` TIMESTAMP(3),
    `validity_days` INT,
    `validity_expires` TIMESTAMP(3),
    `terminate_cause` INT,
    `effective_date` TIMESTAMP(3),
    `finished_time` TIMESTAMP(3),
    `total_progress` DECIMAL(10,2),
    `purchase_time` INT,
    `create_time` TIMESTAMP(3),
    `update_time` TIMESTAMP(3),
    `delete_flag` BOOLEAN,
    `proctime` timestamp,
    dt string comment '日期',
   PRIMARY KEY (id,dt) NOT ENFORCED
) partitioned by (dt)
;

CREATE TABLE if not exists paimon.ods.paimon_ods_oe_order (
    `id` STRING,
    `channel` STRING,
    `student_id` STRING,
    `order_no` STRING,
    `total_amount` DECIMAL(10,2),
    `discount_amount` DECIMAL(10,2),
    `charge_against_amount` DECIMAL(10,2),
    `payable_amount` DECIMAL(10,2),
    `status` INT,
    `pay_status` INT,
    `pay_time` TIMESTAMP(3),
    `paid_amount` DECIMAL(10,2),
    `effective_date` TIMESTAMP(3),
    `terminal` INT,
    `refund_status` INT,
    `refund_amount` DECIMAL(10,2),
    `refund_time` TIMESTAMP(3),
    `create_time` TIMESTAMP(3),
    `update_time` TIMESTAMP(3),
    `delete_flag` BOOLEAN,
    `proctime` timestamp,
    dt string comment '日期',
   PRIMARY KEY (id,dt) NOT ENFORCED
) partitioned by (dt)
;

kafka_ods_to_paimon_ods

BEGIN STATEMENT SET;
insert into paimon.ods.paimon_ods_oe_stu_course_order
select
    *,
    date_format(create_time,'yyyy-MM-dd') as dt
from dw.kafka_ods_oe_stu_course_order;
insert into paimon.ods.paimon_ods_oe_stu_course
select
    *,
    date_format(create_time,'yyyy-MM-dd') as dt
from dw.kafka_ods_oe_stu_course;
insert into paimon.ods.paimon_ods_oe_order
select
    *,
    date_format(create_time,'yyyy-MM-dd') as dt
from dw.kafka_ods_oe_order;
END;

附录

组件安装

安装jdk:
yum list java
yum install java-1.8.0-openjdk-devel.x86_64
cd /usr/lib/jvm/
环境变量配置:
vim /etc/profile

export JAVA_HOME=/usr/lib/jvm/java
export JRE_HOME= J A V A H O M E / j r e e x p o r t C L A S S P A T H = . : JAVA_HOME/jre export CLASSPATH=.: JAVAHOME/jreexportCLASSPATH=.:JAVA_HOME/lib: J R E H O M E / l i b : JRE_HOME/lib: JREHOME/lib:CLASSPATH
export PATH= P A T H : PATH: PATH:JRE_HOME/bin:$JAVA_HOME/bin

安装zk:
创建目录:
mkdir -p /export/software
mkdir -p /export/server
mkdir -p /export/data

cd /export/software
wget https://archive.apache.org/dist/zookeeper/zookeeper-3.5.10/apache-zookeeper-3.5.10-bin.tar.gz
tar -zxf apache-zookeeper-3.5.10-bin.tar.gz -C /export/server/
cd /export/server

ln -s apache-zookeeper-3.5.10-bin/ zookeeper

cd /export/data
mkdir zkdata

cd /export/server/zookeeper/conf
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg
#修改
dataDir=/export/data/zkdata
#文件最后添加 2888心跳端口 3888选举端口
server.1=172.26.254.71:2888:3888
#为内网ip创建myid文件
mkdir -p /export/data/zkdata
echo 1 >/export/data/zkdata/myid
#启动、查看进程是否启动
cd /export/server/zookeeper/bin/
./zkServer.sh start

#Kafka安装
下载安装包
cd /export/software
wget https://downloads.apache.org/kafka/3.5.0/kafka_2.12-3.5.0.tgz
解压安装包
cd /export/software/
tar -zxvf kafka_2.12-3.5.0.tgz -C /export/server/
@创建软链接
cd /export/server
ln -s /export/server/kafka_2.12-3.5.0 kafka
创建/export/data/kafka-logs目录
cd /export/data
mkdir kafka-logs
修改配置
cd /export/server/kafka/config
vim server.properties
#指定broker的id
broker.id=0
#指定 kafka的绑定监听的地址
listeners=PLAINTEXT://172.18.12.37:9092
#指定Kafka数据的位置
log.dirs=/export/data/kafka-logs
#配zk节点
zookeeper.connect=172.18.12.37:2181
注意:配置文件中要填入服务器内网ip,而不能填入域名,否则会导致后续flink连接不上kafka
配胃环境变量
vim /etc/profile
export KAFKA_HOME=/export/server/kafka
export PATH=: P A T H : PATH: PATH:{KAFKA_HOME}/bin
刷新环境变量
source /etc/profile
启动服务
cd /export/server/kafka/bin/
./kafka-server-start.sh -daemon …/config/server.properties
查看服务jps
常用命令
#查看所有主题
kafka-topics.sh --list --bootstrap-server 172.26.254.71:9092
#创建topic
kafka-topics.sh --create --topic test --bootstrap-server 172.26.254.71:9092

#MySQL安装
yum install -y perl.x86_64
yum install -y libaio.x86_64
yum install -y net-tools.x86_64
下载解压
mkdir /export/server/mysql5.7
cd /export/software/
wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
tar -xvf /export/software/mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar -C /export/server/mysql5.7
cd /export/server/mysql5.7
rpm安装mysql
rpm -ivh mysql-community-common-5.7.29-1.el7.x86_64.rpm mysql-community-libs-5.7.29-1.el7.x86_64.rpm mysql-community-client-5.7.29-1.el7.x86_64.rpm mysql-community-server-5.7.29-1.el7.x86_64.rpm
初始化服务和修改文件权限
mysqld --initialize
chown mysql:mysql /var/lib/mysql -R
启动服务并设骂开机自启
systemctl start mysqld.service
systemctl enable mysqld.service
登录Mysql修改密码及配置远程登录
Pass=$(grep ‘A temporary password’ /var/log/mysqld.log |awk '{print KaTeX parse error: Expected 'EOF', got '}' at position 3: NF}̲') mysql -uroot…Pass"

mysgl>alter user user() identified by “123456”;
use mysql;
GRANT ALL PRIVILEGES ON . TO ‘root’@‘%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/927490.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

什么牌子的运动耳机好、好的运动耳机排行榜

运动与健康息息相关&#xff0c;人们越来越认识到运动带来的益处&#xff0c;例如增强心肺功能、提高新陈代谢率&#xff0c;并能预防多种慢性疾病。随着社交媒体上越来越多人分享自己的运动心得&#xff0c;更多的人也被激发起参与其中的热情。在运动过程中&#xff0c;音乐的…

vue实现表格的动态高度

需求:表格能够根据窗口的大小自动适配页面高度 防抖和节流函数的使用场景是当需要对频繁触发的事件进行限制时,例如: 防抖函数常用于限制用户在短时间内多次触发某一事件,例如搜索框输入并搜索,当用户一直在输入时,我们可以使用防抖函数来避免多次请求搜索结果,减轻服…

【el-tree】树形组件图标的自定义

饿了么树形组件的图标自定义 默认样式: 可以看到el-tree组件左侧自带展开与收起图标,咱们可以把它隐藏:: .groupList {::v-deep .el-tree-node { .el-icon-caret-right {display: none;} } } 我的全部代码 <div class"groupList"><el…

AI 时代,程序员无需焦虑

作者简介&#xff1a; 辭七七&#xff0c;目前大一&#xff0c;正在学习C/C&#xff0c;Java&#xff0c;Python等 作者主页&#xff1a; 七七的个人主页 文章收录专栏&#xff1a; 七七的闲谈 欢迎大家点赞 &#x1f44d; 收藏 ⭐ 加关注哦&#xff01;&#x1f496;&#x1f…

开发电子木鱼功德+1需要多少钱

冥想木鱼小程序是一种结合了冥想和科技的应用形式&#xff0c;为用户提供了随时随地进行冥想的便捷方式。开发一款高质量的冥想木鱼小程序需要综合考虑技术实现、冥想专业性和用户体验等多个方面。本文将详细介绍冥想木鱼小程序的开发过程&#xff0c;并探讨其中的专业性与思考…

数据的画布,洞察的窗口:畅想可视化大屏的未来

可视化大屏&#xff0c;作为信息传达的魔法之笔&#xff0c;正以其独特的魅力在各个领域迅速崭露头角。它将抽象的数据和信息转化为丰富多彩的图形、图表和动画&#xff0c;以更直观、生动的方式呈现在人们的眼前。 无论身处何地&#xff0c;可视化大屏都能显现其强大的应用价…

GPT和AI绘图学习【第13期】,chatgpt文案制作引导并写出爆款小红书推文、AI换脸、客服话术回复等

第13期GPT和AI绘图学习班&#xff0c;主要内容包括&#xff1a;ChatGPT文案制作引导并写出爆款小红书推文、分析数据、策划视频脚本、图片扩展、高效修图、产品设计、平面设计、线镐渲染、AI换脸、客服话术回复等。 目录&#xff1a; 1.第1天&#xff1a;运用GPT提高工作效率…

【随笔】如何使用阿里云的OSS保存基础的服务器环境

使用阿里云OSS创建一个存储仓库&#xff1a;bucket 在Linux上下载并安装阿里云的ossutil工具 // 命令行&#xff0c;是linux环境 3. 安装ossutil。sudo -v ; curl https://gosspublic.alicdn.com/ossutil/install.sh | sudo bash 说明:安装过程中&#xff0c;需要使用解压工具…

MyBatis的核心技术掌握,简单易懂(上)

目录 一.MyBatis中的动态SQL 二.MyBatis中的模糊查询 1. # 符号 2. $ 符号 ---问题 ---所以大家知道 # 和 $ 在MyBatis中的模糊查询中的区别了嘛&#xff1f;&#xff1f; 三.MyBatis 中的结果映射 1. resultType&#xff1a; 2. resultMap&#xff1a; ---问题 ---…

【学习FreeRTOS】第18章——FreeRTOS软件定时器

1.软件定时器的简介 定时器&#xff1a;从指定的时刻开始&#xff0c;经过一个指定时间&#xff0c;然后触发一个超时事件&#xff0c;用户可自定义定时器的周期硬件定时器&#xff1a;芯片本身自带的定时器模块&#xff0c;硬件定时器的精度一般很高&#xff0c;每次在定时时…

文字的力量:如何细节决定工作与个人成长的走向

在工作和个人发展的道路上&#xff0c;写作与沟通是两个不可或缺的技能。而这其中&#xff0c;错别字、敏感词、政治口号、标点错误以及常识性错误这些细节&#xff0c;常常被忽视&#xff0c;但其对个人和工作的影响却是深远的。这些细节不仅直接反映出一个人的专业程度&#…

解决,worldGeo.db中有geom数据的x1表无法在QGIS中成图像

原因:缺少geom数据对应的坐标geometry_columns文件,如下图所示&#xff1a; STEP: 1,在navicat_for_SQLite中将目标表x1中字段geom中blob改成,POINT,或者MULTIPOLYGON等对应的格式 注意&#xff01;&#xff1a;f_table_name 表名 和 f_geometry_column geom空间数据所在字段…

【FPGA】verilog语法的学习与应用 —— 位操作 | 参数化设计

【FPGA】verilog语法的学习与应用 —— 位操作 | 参数化设计 学习新语法&#xff0c;争做新青年 计数器实验升级&#xff0c;让8个LED灯每个0.5s的速率循环闪烁&#xff0c;流水灯ahh好久不见~ 去年光这个就把我折磨够呛。。我肉眼可见的脱发就是从那时候开始的。。在那两个月…

Linux学习记录——이십유 多线程(3)

文章目录 1、生产者消费者模型1、基于BlockingQueue的生产者消费者模型2、对模型全面的认识3、多生产者多消费者 2、信号量1、POSIX信号量2、基于环形队列的生产消费模型3、多生产者多消费者 3、多生产者多消费者模型的意义 1、生产者消费者模型 顾名思义&#xff0c;就像是供…

sed编辑器在windows平台上的使用

一、写在前面 我们经常在linux上使用sed命令去替换文件里面固定字符串&#xff0c;但是有时候我们使用的windows系统&#xff0c;文件太大又不方便传到linux上去操作&#xff0c;反复上去和下载浪费空间&#xff0c;又浪费传输的带宽。所以在windows上我们也必须要有sed工具&a…

Node.js 的 Buffer 是什么?一站式了解指南

在 Node.js 中&#xff0c;Buffer 是一种用于处理二进制数据的机制。它允许你在不经过 JavaScript 垃圾回收机制的情况下直接操作原始内存&#xff0c;从而更高效地处理数据&#xff0c;特别是在处理网络流、文件系统操作和其他与 I/O 相关的任务时。Buffer 是一个全局对象&…

为DOSBOX创建互联网能力

DOSBOX能运行DOS游戏及MASM&#xff0c; C等开发语言&#xff0c;要让它联接互联网还是要一些特殊配置的。 1. 安装npcap软件 下载最新版免费软件npcap.exe&#xff0c;正常安装。它会自己绑定到每一张网卡&#xff0c;建立网卡数据与DOSBOX的交互通道。 2. 查看系统中的网卡…

基于流计算 Oceanus(Flink) CDC 做好数据集成场景

由于第一次做实时&#xff0c;所以踩坑比较多&#xff0c;见谅(测试环境用的flink),小公司没有用到hadoop组件 一、踩坑记录 1:本地代码的flink版本是flink1.15.4&#xff0c;生产环境是flink1.16.1&#xff0c;在使用侧输出流时报错&#xff0c;需要使用以下写法,需要使用Si…

SpingMVC拦截器-异常处理的思路,用户体验不好的地方

1、异常处理机制 1.1 原先我们的异常都是手动的try..catch() 2、他存在着一些缺陷&#xff1a;这里创建了一个Demo的controller,内部有一个show方法&#xff1a; 3、访问内部&#xff0c;我要实现demoshow方法&#xff0c;我们来调用show1和show2的方法&#xff1a; 4、有一…

【HAproxy】

目录 一、概述 1.简介 2.核心功能 3.关键特性 4.应用场景 二、使用步骤 1.内核配置 3.建立配置文件 4.添加为系统服务 5.添加3和5运行级别下自启动 6.启动haproxy 三、调度算法 四、配置文件 五、负载均衡 1.七层负载 1.1 配置负载 1.2 配置监控页面 2.四层负…