【Big Data】Hadoop--MapReduce经典题型实战(单词统计+成绩排序+文档倒插序列)

news2024/9/29 18:49:20

 

🍊本文使用了3个经典案例进行MapReduce实战

🍊参考官方源码,代码风格较优雅

🍊解析详细

一、Introduction

MapReduce是一个分布式运算程序的编程框架,核心功能是将用户写的业务逻辑代码和自身默认代码整合成一个完整的分布式运算程序,并发运行在一个Hadoop集群上

其整体架构逻辑如下

Map读取数据,进行简单数据整理
Shuffle整合Map的数据
Reduce计算处理Shuffle中的数据

二、WordCount

2.1 题目

统计文件中每个单词出现的个数。左侧为原始数据,右侧为输出数据。

2.2 解析

WordCount统计单词个数是最基础的题目,我们除了要完成题目要求之外,代码尽量更加的优雅,因此我们主要参考的是Hadoop官方提供的WordCount案例

数据的走下如下 

2.3 Mapper

Mapper中需要注意的是 Mapper<LongWritable, Text, Text, IntWritable>

<LongWritable,Text>为输入,<Text,IntWritable>为输出,或许很难理解为什么输出是<LongWritable,Text>,其实Text表示每一行的数据,LongWritable为每一行数据第一个数据在整个文件的偏移量,我们打印一下每次的Text和LongWritable

package com.bcn.mapreduce.wordcount;

import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

/**
 * 输入数据为<单词偏移量,单词>
 * 输出数据为<单词,出现次数>
 */
public class WordCountMapper extends Mapper<LongWritable, Text, Text, IntWritable> {
    // Just craete one Text and IntWritable object to reduce waste of resources
    Text outK = new Text();
    IntWritable outV = new IntWritable(1);

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

        // Get one line
        String line = value.toString();
        System.out.println(line);
        System.out.println(key);

        // split the word by space
        String[] words = line.split(" ");

        // output
        for (String word : words) {
            outK.set(word);
            context.write(outK, outV);
        }
    }
}

2.4 Reducer

我们关注的还是数据的走向  Reducer <Text, IntWritable,Text,IntWritable> ,<ext,IntWritable>为数据输入,与Mapper的输出是一致的

这里可能很多人为疑惑为什么输入的是<Text, IntWritable>,但是我们重写reduce时却使用了<Text key,Iterable<IntWritable> values>,这是因为中间省略掉了我们看不见的Shuffle阶段

package com.bcn.mapreduce.wordcount;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class WordCountReducer extends Reducer <Text, IntWritable,Text,IntWritable> {
    int sum;
    IntWritable outV=new IntWritable();
    @Override
    protected void reduce(Text key,Iterable<IntWritable> values, Context context)throws IOException, InterruptedException {
        // Sum up
        sum =0;
        // The data for example apple,(1,1,1)
        for (IntWritable count:values){
            sum += count.get();
        }
        //Output
        outV.set(sum);
        context.write(key,outV);
    }
}

2.4 Dreiver 

最后我们设置启动类,也就是Main函数,在其中会配置7套件,这样就可以运行整个MapReduce程序了

package com.bcn.mapreduce.wordcount;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class WordCountDriver {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        // 1.Get the config and job
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);

        // 2.Connect Driver with jar
        job.setJarByClass(WordCountDriver.class);

        // 3.Connect with Mapper、Reducer
        job.setMapperClass(WordCountMapper.class);
        job.setReducerClass(WordCountReducer.class);

        // 4.Set the class of Mapper output
        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(IntWritable.class);

        // 5.Set the class of final output
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(IntWritable.class);

        // 6.Set the input and output path
        FileInputFormat.setInputPaths(job, new Path("E:\\Hadoop and Spark\\data\\word.txt"));
        FileOutputFormat.setOutputPath(job, new Path("E:\\Hadoop and Spark\\output\\wordCount"));

        // 7.Submit the job
        boolean result = job.waitForCompletion(true);
        System.exit(result ? 0 : 1);

    }

}

三、Grade Sort

3.1 题目

对学生成绩表中总分进行排序(从高到低),若总分相同,则按数学成绩排序(从高到低)

3.2 解析

该题与WordCount相比,特殊处为多了一个排序要求,对于排序问题,我们需要对该数据对象建立一个类对象,并重写readFields()、write()、toString、compareTo(),前三者为模板信息,而compareTo()是需要根据业务编写。

3.3 Entity

关于CompareTo方法,Java中默认是升序的,因此在其前加负号即可成为降序

package com.bcn.mapreduce.gradesort;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student implements WritableComparable<Student> {
    private long id;
    private double chinese;
    private double math;
    private double english;
    private double total;

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        this.id=dataInput.readLong();
        this.chinese=dataInput.readDouble();
        this.math=dataInput.readDouble();
        this.chinese=dataInput.readDouble();
        this.english=dataInput.readDouble();
        this.total=dataInput.readDouble();
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeLong(this.id);
        dataOutput.writeDouble(this.chinese);
        dataOutput.writeDouble(this.math);
        dataOutput.writeDouble(this.chinese);
        dataOutput.writeDouble(this.english);
        dataOutput.writeDouble(this.total);
    }
    @Override
    public String toString() {
        return this.id+"  ,语文:"+this.chinese+", 数学:"+this.math+", 英语:"+this.english+", 总分:"+this.total;
    }

    @Override
    public int compareTo(Student o) {
        int r1=-Double.compare(this.total, o.total);
        if(r1==0){
            return -Double.compare(this.math, o.math);
        }else {
            return r1;
        }
    }

}

3.4 Mapper

注意Mapper的输出是<Student,Text>,由于放入Reducer中,只需要Student这一个信息即可,因此这里的Text只是随意加上去的

package com.bcn.mapreduce.gradesort;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;


public class GradeSortMapper extends Mapper<LongWritable, Text,Student,Text> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        //  Get data
        String[] data=value.toString().split(",");
        long id= Long.parseLong(data[0]);
        double chinese= Double.parseDouble(data[1]);
        double math=Double.parseDouble(data[2]);
        double english=Double.parseDouble(data[3]);
        double total =chinese+math+english;
        Student s=new Student(id,chinese,math,english,total);

        context.write(s,value);
    }
}

3.5 Reducer

package com.bcn.mapreduce.gradesort;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class GradeSortReducer extends Reducer<Student, Text, Text, NullWritable> {
    public static int count=0;
    public Text text=new Text();
    @Override
    protected void reduce(Student s, Iterable<Text> values,Context context) throws IOException, InterruptedException {
        for(Text t:values){
            if (GradeSortReducer.count<10){
                count++;
                text.set(s.toString());
                context.write(text,NullWritable.get());
            }
        }
    }
}

3.6 Driver

package com.bcn.mapreduce.gradesort;

import com.bcn.mapreduce.wordcount.WordCountDriver;
import com.bcn.mapreduce.wordcount.WordCountMapper;
import com.bcn.mapreduce.wordcount.WordCountReducer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class GradeSortDriver {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        // 1.Get the config and job
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);

        // 2.Connect Driver with jar
        job.setJarByClass(GradeSortDriver.class);

        // 3.Connect with Mapper、Reducer
        job.setMapperClass(GradeSortMapper.class);
        job.setReducerClass(GradeSortReducer.class);

        // 4.Set the class of Mapper output
        job.setMapOutputKeyClass(Student.class);
        job.setMapOutputValueClass(Text.class);

        // 5.Set the class of final output
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(NullWritable.class);

        // 6.Set the input and output path
        FileInputFormat.setInputPaths(job, new Path("E:\\Hadoop and Spark\\data\\top10input.txt"));
        FileOutputFormat.setOutputPath(job, new Path("E:\\Hadoop and Spark\\output\\top10input"));

        // 7.Submit the job
        boolean result = job.waitForCompletion(true);
        System.exit(result ? 0 : 1);

    }
}

四、Document Revere

4.1 题目

有大量的文本(文档、网页),需要建立搜索索引。输入数据为三个文档

4.2 解析

与WordCount不同点在于除了要统计每个单词的个数之外,还需要记录每个单词所在的文档。而一个MapReduce可以有多个Map阶段和一个Reduce阶段,遇到这样复杂的业务可以使用两个MapReduce程序串行(使用Partitioner合并成一个也可以,这里使用两个串行比较简单暴力):第一阶段统计单词个数,第二阶段计算每个单词出现在哪个文档中

4.3 Mapper

Mapper1

package com.bcn.mapreduce.document;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;

import java.io.IOException;
import java.util.StringTokenizer;

public class Document1Mapper extends Mapper<Object, Text, Text, Text> {
    private FileSplit filesplit;
    private Text word = new Text();
    private Text temp = new Text("1");

    @Override
    public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
        filesplit = (FileSplit) context.getInputSplit();
        String fileName = filesplit.getPath().getName();
        StringTokenizer itr = new StringTokenizer(value.toString());
        while(itr.hasMoreTokens()){
            word.set(itr.nextToken() + "--" + fileName);
            context.write(word, temp);
        }
    }
}

Mapper2

package com.bcn.mapreduce.document;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;

import java.io.IOException;
import java.util.StringTokenizer;

public class Document2Mapper extends Mapper<LongWritable, Text, Text, Text> {
    private Text Word = new Text();
    private Text Filename = new Text();

    @Override
    public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        String[] all = line.split("	");
        String[] wandc = all[0].split("--");
        String word = wandc[0];
        String document = wandc[1];
        String num = all[1];
        Word.set(word);
        Filename.set(document + " -->" + num + " ");
        context.write(Word, Filename);
    }
}

4.4 Reducer

Reducer1

package com.bcn.mapreduce.document;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;
import java.util.Iterator;

public class Document1Reducer extends Reducer<Text, Text, Text, Text> {
    @Override
    public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
        Iterator<Text> it = values.iterator();
        String s = "";
        StringBuilder wordNum = new StringBuilder();
        if (it.hasNext()) {
            wordNum.append(it.next().toString());
        }
        for (; it.hasNext(); ) {
            wordNum.append(it.next().toString());
        }
        s = s + wordNum.length();
        context.write(key, new Text(s.toString()));
    }
}

Reducer2

package com.bcn.mapreduce.document;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;
import java.util.Iterator;

public class Document2Reducer extends Reducer<Text, Text, Text, Text> {
    public Text text=new Text();
    @Override
    public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
        StringBuilder filename= new StringBuilder("  ");
        for(Text t :values){
            filename.append(t);
        }
        text.set(filename.toString());
        context.write(key,text);
    }
}

4.5 Driver

Driver1

package com.bcn.mapreduce.document;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class Document1Driver {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        // 1.Get the config and job
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);

        // 2.Connect Driver with jar
        job.setJarByClass(Document1Driver.class);

        // 3.Connect with Mapper、Reducer
        job.setMapperClass(Document1Mapper.class);
        job.setReducerClass(Document1Reducer.class);

        // 4.Set the class of Mapper output
        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(Text.class);

        // 5.Set the class of final output
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);

        // 6.Set the input and output path
        FileInputFormat.setInputPaths(job, new Path("E:\\Hadoop and Spark\\data\\doc"));
        FileOutputFormat.setOutputPath(job, new Path("E:\\Hadoop and Spark\\output\\doc"));

        // 7.Submit the job
        boolean result = job.waitForCompletion(true);
        System.exit(result ? 0 : 1);

    }
}

Driver2

package com.bcn.mapreduce.document;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class Document2Driver {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        // 1.Get the config and job
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);

        // 2.Connect Driver with jar
        job.setJarByClass(Document2Driver.class);

        // 3.Connect with Mapper、Reducer
        job.setMapperClass(Document2Mapper.class);
        job.setReducerClass(Document2Reducer.class);

        // 4.Set the class of Mapper output
        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(Text.class);

        // 5.Set the class of final output
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);

        // 6.Set the input and output path
        FileInputFormat.setInputPaths(job, new Path("E:\\Hadoop and Spark\\data\\period1.txt"));
        FileOutputFormat.setOutputPath(job, new Path("E:\\Hadoop and Spark\\output\\doc_result"));

        // 7.Submit the job
        boolean result = job.waitForCompletion(true);
        System.exit(result ? 0 : 1);

    }
}

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

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

相关文章

震源机制沙滩球(focal mechanism beach ball)绘制之傻瓜式教程

目录 1. 断层的定义 2. 绘制流程 3. 更多示例 沙滩球的含义可阅读&#xff1a;震源机制(Focal Mechanisms)之沙滩球(Beach Ball)_ddd...e_bug的博客-CSDN博客 1. 断层的定义&#xff08;&#xff09; 走向&#xff08;strike&#xff09;&#xff1a;正北方顺时针旋转到走向…

第五十四章 DFS进阶(二)——迭代加深

第五十四章 DFS进阶&#xff08;二&#xff09;——迭代加深一、DFS的缺陷二、迭代加深1、什么是迭代加深2、复杂度分析3、算法步骤三、例题1、问题2、分析3、代码一、DFS的缺陷 我们知道DFS是一条路走到黑&#xff0c;直到将整条路走完以后才会回头。 这就导致了一个问题&am…

dynamic-Echonet左心室语义分割——学习记录

1简单介绍 1.1 论文简介 论文地址Video-based AI for beat-to-beat assessment of cardiac function 数据集地址&#xff1a;here获取好像还挺麻烦的。需要在网站上填写并申请数据集&#xff0c;斯坦福那边会发邮件并拉入一个box组&#xff0c;就可以访问公开的超声心动数据集…

图解LeetCode——剑指 Offer 26. 树的子结构

一、题目 输入两棵二叉树A和B&#xff0c;判断B是不是A的子结构。(约定空树不是任意一个树的子结构) B是A的子结构&#xff0c; 即&#xff1a;A中有出现和B相同的结构和节点值。 二、示例 2.1> 示例 1&#xff1a; 【输入】A [1,2,3], B [3,1] 【输出】false 2.2> 示…

数字化转型的成功模版,珠宝龙头曼卡龙做对了什么?

2月11日&#xff0c;曼卡龙&#xff08;300945.SZ&#xff09;发布2022年业绩快报&#xff0c;报告期内&#xff0c;公司实现营业收入16.11亿元&#xff0c;同比增长28.63%。来源&#xff1a;曼卡龙2022年度业绩快报曼卡龙能在2022年实现营收增长尤为不易。2022年受疫情影响&am…

c语言操作文件

1、文件缓冲区 文件缓冲区的目的&#xff1a;提高访问效率 提高磁盘使用寿命 刷新就是将当前缓冲区数据全部提交。 不刷新时&#xff0c;程序在崩溃时缓冲区内容无法输出&#xff08;有些情形会带来错误&#xff09; 文件缓冲区的四种刷新方式 行刷新&#xff08;遇到换行符…

CSS3新增属性( 过渡、变形和动画)

文章目录一、过渡1、transition-property2、transition-duration3、transition-timing-function4、transition-delay二、变形1、transform2、2D变形2.1、平移&#xff08;translate&#xff09;2.2、缩放&#xff08;scale&#xff09;2.3、倾斜&#xff08;shew&#xff09;2.…

【记录】smartctl|Linux如何通过smartctl查看有没有坏的磁盘?以及使用时长、电源周期、故障记录等

smartctl是一个用于监测和分析硬盘健康状态的工具&#xff0c;可以用于检测是否存在坏的磁盘。以下是使用smartctl检查磁盘健康状态的步骤&#xff1a; 安装smartctl软件 在Linux系统中&#xff0c;smartctl通常包含在smartmontools软件包中。如果您还没有安装smartmontools&am…

Mr. Cappuccino的第38杯咖啡——Kubernetes中Pod、Namespace、Label、Deployment、Service之间的关系

Kubernetes中Pod、Namespace、Label、Deployment、Service之间的关系Pod、Namespace、Label、Deployment、Service之间的关系NamespacePod1. 创建一个namespace并运行一个pod2. 查看pod3. 删除pod4. 删除pod控制器Label1. 创建yaml文件&#xff08;nginx-pod.yaml&#xff09;2…

【数据结构与算法】二分查找 移除元素

今日任务 数组理论基础 704.二分查找 27.移除元素 1.数组理论基础 &#xff08;1&#xff09;数组是存放在连续内存空间上的相同类型数据的集合。 注意&#xff1a; 数组下标都是从0开始的数组内存空间的地址是连续的 &#xff08;2&#xff09;正因为数组在内存空间的…

【C语言】字符串处理函数及典例(2)

接上&#xff1a;【C语言】字符串处理函数及典例&#xff08;1&#xff09; 之前在&#xff08;1&#xff09;中讨论的函数如strcpy&#xff0c;strcmp&#xff0c;strcat &#xff0c;都是长度不受限制函数&#xff0c;即不管参数的大小&#xff0c;关键点都是找到 \0 &…

ChatGPT爆火出圈,高质量文本标注数据成关键

“2022年11月30日&#xff0c;OpenAI发布了ChatGPT——一个对话式AI&#xff0c;上线仅五天&#xff0c;注册用户数突破100万&#xff0c;爆火出圈&#xff0c;成为社会热议话题。截止今年1月末&#xff0c;ChatGPT的月活用户数量破亿&#xff0c;成为史上用户数增长最快的消费…

Java字节流

4 字节流 字节流抽象基类 InputStream&#xff1a;这个抽象类是表示字节输入流的所有类的超类OutputStream&#xff1a;这个抽象类是表示字节输出流的所有类的超类子类名特点&#xff1a;子类名称都是以其父类名作为子类名的后缀 4.1 IO流概述和分类 IO流概述&#xff1a; …

Spring之基于xml的自动装配、基于Autowired注解的自动装配

文章目录基于xml的自动装配①注解②扫描③新建Maven Module④创建Spring配置文件⑤标识组件的常用注解⑥创建组件⑦扫描组件⑧测试⑨组件所对应的bean的id基于注解的自动装配①场景模拟②Autowired注解③Autowired注解其他细节④Autowired工作流程Autowire 注解的原理Qualifier…

深圳的商户们有福啦!小微企业、个体工商户的扶持举措又来了!

深圳的商户们有福啦&#xff01;近日&#xff0c;深圳8部门联合印发《关于进一步支持中小微企业纾困及高质量发展的若干措施》&#xff0c;从纾困和高质量发展的角度&#xff0c;在降低企业生产经营成本、有效扩大市场需求、支持中小企业创新发展、促进中小企业转型升级4个方面…

2.Visual Studio下载和安装

Visual Studio 是微软提供的一个集成开发环境&#xff08;IDE&#xff09;&#xff0c;主要用于为 Windows 系统开发应用程序。Visual Studio 提供了构建 .Net 平台应用程序的一站式服务&#xff0c;可以使用 Visual Studio 开发、调试和运行应用程序。 1、Visual Studio下载 …

ESP-C3入门9. 创建TCP Server

ESP-C3入门9. 创建TCP Server一、ESP32 IDF的TCP/IP协议栈二、BSD套接字API介绍三、创建TCP Server的步骤1. 引用TCP/IP协议栈2. 创建 TCP套接字拼绑定端口3. 接收客户端请求4. 启动服务四、完整代码1. wifi.h2. wifi.c3. tcpServer.h4. tcpServer.c5. main.c6. CmakeLists.txt…

BNB Greenfield 成存储赛道“新贵”,BNB 生态的野心与破局

“从BNB Beacon Chain&#xff0c;到BNB Chain&#xff0c;再到BNB Greenfield &#xff0c;三位一体的 BNB 生态格局正式形成。 ”在今年的2月1日&#xff0c;币安发布了分布式存储链BNB Greenfield&#xff0c;根据白皮书信息&#xff0c;它的特别之处在于其不仅具备基于SP&a…

完成四种方式的MySQL安装

1.仓库安装 1.1查看版本和安装mysql包 [rootlocalhost ~]# cat /etc/redhat-release Red Hat Enterprise Linux release 9.1 (Plow) [rootlocalhost ~]# rpm -ivh https://repo.mysql.com/mysql80-community-release-el9-1.noarch.rpm1.2装包 [rootlocalhost ~]# dnf instal…

千峰jquery【案例】

滑动选项卡&#xff1a; <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8" /><meta http-equiv"X-UA-Compatible" content"IEedge" /><meta name"viewport" content"widt…