大数据去重

实验4  大数据去重

1.实验目的

通过Hadoop数据去重实验,学生可以掌握准备数据、伪分布式文件系统配置方法,以及在集成开发环境Eclipse中实现Hadoop数据去重方法。

2.实验要求

了解基于Hadoop处理平台的大数据去重过程,理解其主要功能,并能够在Hadoop环境下独立完成。

(1)制订实验计划。

(2)准备数据。

(3)伪分布式文件系统配置。

(4)在集成开发环境Eclipse中实现Hadoop数据去重。

3.实验内容

(1)制订实验计划。

(2)进入“/usr/local/hadoop”目录。

(3)准备数据。

(4)修改“/usr/local/hadoop/etc/hadoop/”目录下的Hadoop配置文件。

(5)NameNode格式化。

(6)在集成开发环境Eclipse中实现Hadoop数据去重。

4.实验总结

通过本实验,使学生了解Hadoop数据去重的特点和过程、理解MapReduce程序的执行过程,掌握NameNode的格式化方法、Hadoop的配置文件的修改和Eclipse开发环境下实现Hadoop数据去重的方法。

5.思考拓展

(1)为什么需要NameNode格式化?说明NameNode格式化方法。

1.清空dfs.name.dir和dfs.name.edits.dir两个目录下的所有文件
2.在目录dfs.name.dir下创建文件:

[plain] view plaincopy

{dfs.name.dir}/current/fsimage  

{dfs.name.dir}/current/fstime  

{dfs.name.dir}/current/VERSION  

{dfs.name.dir}/image/fsimage  

  • 1
  • 2
  • 3
  • 4
  • 5

3.在目录dfs.name.edits.dir下创建文件:

[plain] view plaincopy

{dfs.name.edits.dir}/current/edits  

{dfs.name.edits.dir}/current/fstime  

        {dfs.name.edits.dir}/current/VERSION  

        {dfs.name.edits.dir}/image/fsimage

(2)为什么需要数据去重?说明Hadoop数据去重的主要优势。

与传统的数据仓库相比,Hadoop 的分布式架构,实现了既能够处理关系型数据库当中的结构化数据,也能够处理例如视频、音频图片等非结构化数据,并且还能根据数据任务的规模和复杂程度,实现轻松的扩展。

所以 Hadoop能处理哪些类型数据?概括点来说,就是传统的结构化数据,文字图片等,以及非结构化的数据,视频、音频等,都能基于Hadoop框架技术得到合理的处理

Hadoop处理大数据,主要通过分布式技术来解决各种类型的数据问题一-

并行化问题:处理数据的应用程序要改造成适合并行的方式;资源分配管理问题:如何有效的管理提交任务的资源,内存、网络、磁盘等;

容错问题:随着机器数量的增加,可靠性如何保证,例如部分机器硬件出错导致不可用,最终结果的完整性和正确性如何保证。

(3)结合MapReduce程序执行过程,说明Hadoop数据去重是离线处理还是在线处理。

1. MapReduce 定义
Hadoop中的 MapReduce是一个使用简单的软件框架,基于它写出来的应用程序能够运行在由上千个商用机器组成的大型集群上,并以一种可靠容错式并行处理TB级别的数据集
2. MapReduce 特点
MapReduce 之所以如此受欢迎,它主要有以下几个特点。:
- MapReduce 易于编程。它简单的实现一些接口,就可以完成一个分布式程序,这个分布式程序可以分布到大量廉价的 PC 机器运行。也就是说你写一个分布式程序,跟写一个简单的串行程序是一模一样的。 就是因为这个特点使得 MapReduce 编程变得非常流行。
- 良好的扩展性。当你的计算资源不能得到满足的时候,你可以通过简单的增加机器来扩展它的计算能力。
**- 高容错性。**MapReduce 设计的初衷就是使程序能够部署在廉价的 PC 机器上,这就要求它具有很高的容错性。比如其中一台机器挂了,它可以把上面的计算任务转移到另外一个节点上面上运行,不至于这个任务运行失败,而且这个过程不需要人工参与,而完全是由 hadoop 内部完成的。
- 适合 PB 级以上海量数据的离线处理。这里加红字体离线处理,说明它适合离线处理而不适合在线处理。比如像毫秒级别的返回一个结果,MapReduce 很难做到。
MapReduce 虽然具有很多的优势,但是它也有不擅长的地方。这里的不擅长不代表它不能做,而是在有些场景下实现的效果差,并不适合 MapReduce 来处理,主要表现在以下几个方面。
- 实时计算。MapReduce 无法像 MySQL 一样,在毫秒或者秒级内返回结果。
- 流式计算。流式计算的输入数据时动态的,而 MapReduce 的输入数据集是静态的,不能动态变化。这是因为 MapReduce 自身的设计特点决定了数据源必须是静态的。
- DAG(有向图)计算。多个应用程序存在依赖关系,后一个应用程序的输入为前一个的输出。在这种情况下,MapReduce 并不是不能做,而是使用后,每个MapReduce 作业的输出结果都会写入到磁盘,会造成大量的磁盘IO,导致性能非常的低下。

3. MapReduce的架构
目前存在两种 MapReduce 实现,分别是
• 可独立运行的 MapReduce
它由两类服务组成,分别是 JobTracker 和 TaskTraker,其中 JobTracker 存在单点故障问题,本文提到的单点故障实际上是第一种实现中JobTracker的单点故障。
• MapReduce On YARN
在这种实现中,每个作业独立使用一个作业跟踪器(ApplicationMaster),彼此之间不再相互影响,不存在单点故障问题。

(4)说明在集成开发环境Eclipse中实现Hadoop数据去重的主要过程。

一、MapReduce 模型简介

MapReduce 将复杂的、运行于大规模集群上的并行计算过程高度地抽象到了两个函数:Map 和 Reduce 。它采用  分而治之  策略,一个存储在分布式文件系统中的大规模数据集,会被切分成许多独立的分片(split ),这些分片可以被多个 Map 任务并行处理。

1.Map 和 Reduce 函数

2.MapReduce 体系结构

MapReduce 体系结构主要由四个部分组成,分别是: Client  JobTracker、 TaskTracker 以及 Task

1)Client

  用户编写的MapReduce程序通过Client提交到JobTracker端 用户可通过Client提供的一些接口查看作业运行状态

2)JobTracker

JobTracker负责资源监控和作业调度 JobTracker 监控所有TaskTracker与Job的健康状况,一旦发现失败,就将相应的任务转移到其他节点 JobTracker 会跟踪任务的执行进度、资源使用量等信息,并将这些信息告诉任务调度器(TaskScheduler),而调度器会在资源出现空闲时,选择合适的任务去使用这些资源

3)TaskTracker

TaskTracker 会周期性地通过“心跳”将本节点上资源的使用情况和任务的运行进度汇报给JobTracker,同时接收JobTracker 发送过来的命令并执行相应的操作(如启动新任务、杀死任务等) TaskTracker 使用“slot”等量划分本节点上的资源量(CPU、内存等)。一个Task 获取到一个slot 后才有机会运行,而Hadoop调度器的作用就是将各个TaskTracker上的空闲slot分配给Task使用。slot 分为Map slot 和Reduce slot 两种,分别供MapTask 和Reduce Task 使用

4)Task

Task 分为Map Task 和Reduce Task 两种,均由TaskTracker 启动

3.MapReduce 工作流程

1) 工作流程概述

 

  • 不同的Map任务之间不会进行通信
  • 不同的Reduce任务之间也不会发生任何信息交换
  • 用户不能显式地从一台机器向另一台机器发送消息
  • 所有的数据交换都是通过MapReduce框架自身去实现的

2) MapReduce各个执行阶段

 4.MapReduce 应用程序执行过程

 


 二、MapReduce 实战

1.数据去重

"数据去重"主要是为了掌握和利用并行化思想来对数据进行有意义的筛选。统计大数据集上的数据种类个数、从网站日志中计算访问地等这些看似庞杂的任务都会涉及数据去重。

1.1实例描述

对数据文件中的数据进行去重。数据文件中的每行都是一个数据。样例输入如下所示:

1)file1:

2012-3-1 a

2012-3-2 b

2012-3-3 c

2012-3-4 d

2012-3-5 a

2012-3-6 b

2012-3-7 c

2012-3-3 c

2)file2:

2012-3-1 b

2012-3-2 a

2012-3-3 b

2012-3-4 d

2012-3-5 a

2012-3-6 c

2012-3-7 d

2012-3-3 c

样例输出如下所示:

2012-3-1 a

2012-3-1 b

2012-3-2 a

2012-3-2 b

2012-3-3 b

2012-3-3 c

2012-3-4 d

2012-3-5 a

2012-3-6 b

2012-3-6 c

2012-3-7 c

1.2 解题思路

map阶段:将每一行的文本作为键值对的key

 reduce阶段:将每一个公用的键组输出

1.3 代码展示

package datadeduplicate.pers.xls.datadeduplicate;

 

import java.io.IOException;

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.Mapper;

import org.apache.hadoop.mapreduce.Reducer;

import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;

import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;

import org.apache.log4j.BasicConfigurator;

 

public class Deduplication {

    public static void main(String[] args) throws Exception {

     BasicConfigurator.configure(); //自动快速地使用缺省Log4j环境

     //必须要传递的是自定的mapper和reducer的类,输入输出的路径必须指定,输出的类型<k3,v3>必须指定

     //1首先寫job,知道需要conf和jobname在去創建即可

                Configuration conf=new Configuration();

                String jobName=Deduplication.class.getSimpleName();

                Job job = Job.getInstance(conf, jobName);

                //2将自定义的MyMapper和MyReducer组装在一起

                //3读取HDFS內容:FileInputFormat在mapreduce.lib包下

                FileInputFormat.setInputPaths(job, new Path(args[0]));

                //4指定解析<k1,v1>的类(谁来解析键值对)

                //*指定解析的类可以省略不写,因为设置解析类默认的就是TextInputFormat.class

                job.setInputFormatClass(TextInputFormat.class);

                //5指定自定义mapper类

                job.setMapperClass(MyMapper.class);

                //6指定map输出的key2的类型和value2的类型  <k2,v2>

                //*下面两步可以省略,当<k3,v3>和<k2,v2>类型一致的时候,<k2,v2>类型可以不指定

                job.setMapOutputKeyClass(Text.class);

                job.setMapOutputValueClass(Text.class);

                //7分区(默认1个),排序,分组,规约 采用 默认

                job.setCombinerClass(MyReducer.class);

                //接下来采用reduce步骤

                //8指定自定义的reduce类

                job.setReducerClass(MyReducer.class);

                //9指定输出的<k3,v3>类型

                job.setOutputKeyClass(Text.class);

                job.setOutputValueClass(Text.class);

                //10指定输出<K3,V3>的类

                 //*下面这一步可以省

                job.setOutputFormatClass(TextOutputFormat.class);

                //11指定输出路径

                FileOutputFormat.setOutputPath(job, new Path(args[1]));

                //12写的mapreduce程序要交给resource manager运行

                job.waitForCompletion(true);

                //*13最后,如果要打包运行改程序,则需要调用如下行

                job.setJarByClass(Deduplication.class);

    }

    private static class MyMapper extends Mapper<Object, Text, Text, Text>{

        private static Text line=new Text();

        @Override

        protected void map(Object k1, Text v1,Mapper<Object, Text, Text, Text>.Context context) throws IOException, InterruptedException {

            line=v1;//v1为每行数据,赋值给line

            context.write(line, new Text(""));

         }

    }

    private static class MyReducer extends Reducer<Text, Text, Text, Text>

    {

        @Override

        protected void reduce(Text k2, Iterable<Text> v2s,Reducer<Text, Text, Text, Text>.Context context) throws IOException, InterruptedException {

             context.write(k2, new Text(""));

         }

    }

}

1.4 运行结果展示

打包项目成可运行的jar包,上传的hdfs文件系统:

 

 在linux系统下终端输入hadoop命令,在建立的hadoop节点上运行jar包:

 查看eclipse中hdfs文件系统下out文件夹,发现生成了先前指定的deduplication文件夹,其中part-r-00000为运行的输出。

 2.数据排序

package dararank.pers.xls.datarank;

 

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.Mapper;

import org.apache.hadoop.mapreduce.Reducer;

import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.util.GenericOptionsParser;

import org.apache.log4j.BasicConfigurator;

import java.io.IOException;

 

public class DataRank {

    /**

     * 使用Mapper将数据文件中的数据本身作为Mapper输出的key直接输出

     */

    public static class forSortedMapper extends Mapper<Object, Text, IntWritable, IntWritable> {

        private IntWritable mapperValue = new IntWritable(); //存放key的值

        public void map(Object key, Text value, Context context)

                throws IOException, InterruptedException {

            String line = value.toString(); //获取读取的值,转化为String

            mapperValue.set(Integer.parseInt(line)); //将String转化为Int类型

            context.write(mapperValue,new IntWritable(1)); //将每一条记录标记为(key,value) key--数字 value--出现的次数

          //每出现一次就标记为(number,1)

        }

    }

 

    /**

     * 使用Reducer将输入的key本身作为key直接输出

     */

 public static class forSortedReducer extends Reducer<IntWritable, IntWritable, IntWritable, IntWritable>{

        private IntWritable postion = new IntWritable(1); //存放名次

        @Override

        protected void reduce(IntWritable key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {

            for (IntWritable item :values){ //同一个数字可能出多次,就要多次并列排序

                context.write(postion,key); //写入名次和具体数字

                System.out.println(postion + "\t"+ key);

                postion = new IntWritable(postion.get()+1); //名次加1

            }

        }

    }

 

 

    public static void main(String[] args) throws Exception {

 

     BasicConfigurator.configure(); //自动快速地使用缺省Log4j环境

        

     Configuration conf = new Configuration(); //设置MapReduce的配置

        String[] otherArgs = new GenericOptionsParser(conf,args).getRemainingArgs();

        if(otherArgs.length < 2){

            System.out.println("Usage: datarank <in> [<in>...] <out>");

            System.exit(2);

        }

        //设置作业

        //Job job = new Job(conf);

        Job job = Job.getInstance(conf);

        job.setJarByClass(DataRank.class);

        job.setJobName("DataRank");

        //设置处理map,reduce的类

        job.setMapperClass(forSortedMapper.class);

        job.setReducerClass(forSortedReducer.class);

        //设置输入输出格式的处理

        job.setOutputKeyClass(IntWritable.class);

        job.setOutputValueClass(IntWritable.class);

        //设定输入输出路径

        for (int i = 0; i < otherArgs.length-1;++i){

            FileInputFormat.addInputPath(job,new Path(otherArgs[i]));

        }

        FileOutputFormat.setOutputPath(job, new Path(otherArgs[otherArgs.length-1]));

        System.exit(job.waitForCompletion(true)?0:1);

    }

 

}

3.平均成绩

package averagescoreapp.pers.xls.averagescoreapp;

 

import java.io.IOException;

import java.util.StringTokenizer;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.io.DoubleWritable;

import org.apache.hadoop.io.IntWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Job;

import org.apache.hadoop.mapreduce.Mapper;

import org.apache.hadoop.mapreduce.Reducer;

import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.util.GenericOptionsParser;

import org.apache.log4j.BasicConfigurator;

 

/**

 * 求平均成绩

 *

 */

public class AverageScoreApp {

 

public static class Map extends Mapper<Object, Text, Text, IntWritable>{

@Override

protected void map(Object key, Text value, Mapper<Object, Text, Text, IntWritable>.Context context) throws IOException, InterruptedException {

//成绩的结构是:

// 张三 80

// 李四 82

// 王五 86

StringTokenizer tokenizer = new StringTokenizer(value.toString(), "\n");

while(tokenizer.hasMoreElements()) {

StringTokenizer lineTokenizer = new StringTokenizer(tokenizer.nextToken());

String name = lineTokenizer.nextToken(); //姓名

String score = lineTokenizer.nextToken();//成绩

context.write(new Text(name), new IntWritable(Integer.parseInt(score)));

}

}

}

public static class Reduce extends Reducer<Text, IntWritable, Text, DoubleWritable>{

@Override

protected void reduce(Text key, Iterable<IntWritable> values,Reducer<Text, IntWritable, Text, DoubleWritable>.Context context)

throws IOException, InterruptedException {

//reduce这里输入的数据结构是:

// 张三 <80,85,90>

// 李四 <82,88,94>

// 王五 <86,80,92>

int sum = 0;//所有课程成绩总分

double average = 0;//平均成绩

int courseNum = 0; //课程数目

for(IntWritable score:values) {

sum += score.get();

courseNum++;

}

average = sum/courseNum;

context.write(new Text(key), new DoubleWritable(average));

}

}

public static void main(String[] args) throws Exception{

BasicConfigurator.configure(); //自动快速地使用缺省Log4j环境

Configuration conf = new Configuration();

String[] otherArgs = new GenericOptionsParser(conf,args).getRemainingArgs();

        if(otherArgs.length < 2){

            System.out.println("Usage: AverageScoreRank <in> [<in>...] <out>");

            System.exit(2);

        }

Job job = Job.getInstance(conf);

job.setJarByClass(AverageScoreApp.class);

job.setMapperClass(Map.class);

job.setReducerClass(Reduce.class);

job.setMapOutputKeyClass(Text.class);

job.setMapOutputValueClass(IntWritable.class);

job.setOutputKeyClass(Text.class);

job.setOutputValueClass(DoubleWritable.class);

 //设定输入输出路径

        for (int i = 0; i < otherArgs.length-1;++i){

            FileInputFormat.addInputPath(job,new Path(otherArgs[i]));

        }

        FileOutputFormat.setOutputPath(job, new Path(otherArgs[otherArgs.length-1]));

System.exit(job.waitForCompletion(true)?0:1);

}

 

}

 4.单表关联

package singletabblerelation.pers.xls.singletablerelation;

 

import java.io.IOException;

import java.util.ArrayList;

import java.util.List;

import java.util.StringTokenizer;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.io.LongWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Job;

import org.apache.hadoop.mapreduce.Mapper;

import org.apache.hadoop.mapreduce.Reducer;

import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.util.GenericOptionsParser;

import org.apache.log4j.BasicConfigurator;

 

public class SingleTableRelation {

    public static int time = 0;

    public static class Map extends Mapper<LongWritable, Text, Text, Text> {

    protected void map(LongWritable key, Text value, Context context)throws java.io.IOException, InterruptedException {

         // 左右表的标识

            int relation;

            StringTokenizer tokenizer = new StringTokenizer(value.toString());

            String child = tokenizer.nextToken();

            String parent = tokenizer.nextToken();

            if (child.compareTo("child") != 0) {

                // 左表

                relation = 1;

                context.write(new Text(parent), new Text(relation + "+" + child));

                // 右表

                relation = 2;

                context.write(new Text(child), new Text(relation + "+" + parent));

            }

        };

 

    }

 

    public static class Reduce extends Reducer<Text, Text, Text, Text> {

        protected void reduce(Text key, Iterable<Text> values,

                Reducer<Text, Text, Text, Text>.Context output)

                throws java.io.IOException, InterruptedException {

            int grandchildnum = 0;

            int grandparentnum = 0;

            List<String> grandchilds = new ArrayList<>();

            List<String> grandparents = new ArrayList<>();

            /** 输出表头 */

            if (time == 0) {

                output.write(new Text("grandchild"), new Text("grandparent"));

                time++;

            }

            for (Text val : values) {

                String record = val.toString();

                char relation = record.charAt(0);

                // 取出此时key所对应的child

                if (relation == '1') {

                    String child = record.substring(2);

                    grandchilds.add(child);

                    grandchildnum++;

                }

                // 取出此时key所对应的parent

                else {

                    String parent = record.substring(2);

                    grandparents.add(parent);

                    grandparentnum++;

                }

            }

            if (grandchildnum != 0 && grandparentnum != 0) {

                for (int i = 0; i < grandchildnum; i++)

                    for (int j = 0; j < grandparentnum; j++)

                        output.write(new Text(grandchilds.get(i)), new Text(

                                grandparents.get(j)));

            }

 

        }

    }

 

    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {

BasicConfigurator.configure(); //自动快速地使用缺省Log4j环境

//必须要传递的是自定的mapper和reducer的类,输入输出的路径必须指定,输出的类型<k3,v3>必须指定

            //2将自定义的MyMapper和MyReducer组装在一起

            Configuration conf=new Configuration();

            String[] otherArgs = new GenericOptionsParser(conf,args).getRemainingArgs();

            if(otherArgs.length < 2){

                System.out.println("Usage: SingleTableRelation <in> [<in>...] <out>");

                System.exit(2);

            }

            String jobName=SingleTableRelation.class.getSimpleName();

            //1首先寫job,知道需要conf和jobname在去創建即可

             Job job = Job.getInstance(conf, jobName);

        job.setJarByClass(SingleTableRelation.class);

        job.setMapperClass(Map.class);

        job.setReducerClass(Reduce.class);

        job.setOutputKeyClass(Text.class);

        job.setOutputValueClass(Text.class);

        //设定输入输出路径

        for (int i = 0; i < otherArgs.length-1;++i){

            FileInputFormat.addInputPath(job,new Path(otherArgs[i]));

        }

        FileOutputFormat.setOutputPath(job, new Path(otherArgs[otherArgs.length-1]));       

        System.exit((job.waitForCompletion(true) ? 0 : 1));

    }

}


 三、总结

hadoop 是一个分布式的基础架构,利用分布式实现高效的计算与储存,最核心的设计在于 HDFS 与 MapReduce 

HDFS 在集群上实现了分布式文件系统, MapReduce 则在集群上实现了分布式计算和任务处理。HDFS 在 MapReduce 任务处理过程中提供了对文件操作和存储等的支持。而MapReduce在 HDFS 的基础上实现任务的分发、跟踪和执行等工作,并收集结果,两种相互作用,完成了 Hadoop 分布式集群的主要任务。

通过这四个实战的题目我进一步掌握了 Hadoop 架构在现实生活中的应用。

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

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

相关文章

http协议、全站https

一、http协议 1、为何要学http协议? 用户用浏览器访问网页,默认走的都是http协议,所以要深入研究web层,必须掌握http协议 2、什么是http协议 1、全称Hyper Text Transfer Protocol(超文本传输协议) ### 一个请求得到一个响应包 普通…

使用 Logstash 迁移 MongoDB 数据到 Easysearch

大家好&#xff01;在前面的文章中&#xff0c;我们已经详细介绍了如何通过 Logstash 和 Canal 工具实现 MySQL 数据向 Easysearch 的迁移。如果您正在使用 MongoDB 作为数据存储&#xff0c;并希望将其数据迁移到 Easysearch 中&#xff0c;这篇指南或许能为您提供一些帮助。 …

亚马逊英国站FBA费用重构:轻小商品迎红利期,跨境卖家如何抢占先机?

一、政策背景&#xff1a;成本优化成平台与卖家共同诉求 2024年4月&#xff0c;亚马逊英国站&#xff08;Amazon.co.uk&#xff09;发布近三年来力度最大的FBA费用调整方案&#xff0c;标志着英国电商市场正式进入精细化成本管理时代。这一决策背后&#xff0c;是多重因素的叠…

使用Qt Quick Controls创建自定义日历组件

目录 引言相关阅读1. DayOfWeekRow2. MonthGrid3. WeekNumberColumn 项目结构及实现工程结构图代码实现及解析1. 组件封装2. 主界面实现 运行效果 总结下载链接 引言 Qt6 Quick框架提供了一套丰富的日历相关组件&#xff0c;包括 MonthGrid、DayOfWeekRow 和 WeekNumberColumn…

【AI微信小程序开发】大转盘小程序项目代码:自设转盘选项和概率(含完整前端+后端代码)

系列文章目录 【AI微信小程序开发】AI减脂菜谱小程序项目代码:根据用户身高/体重等信息定制菜谱(含完整前端+后端代码)【AI微信小程序开发】AI菜谱推荐小程序项目代码:根据剩余食材智能生成菜谱(含完整前端+后端代码)【AI微信小程序开发】图片工具小程序项目代码:图片压…

redis相关问题整理

Redis 支持多种数据类型&#xff1a; 字符串 示例&#xff1a;存储用户信息 // 假设我们使用 redis-plus-plus 客户端库 auto redis Redis("tcp://127.0.0.1:6379"); redis.set("user:1000", "{name: John Doe, email: john.doeexample.com}"…

Vue-组件的懒加载,按需加载

在Vue项目中实现组件的懒加载&#xff08;也称为按需加载或代码分割&#xff09;&#xff0c;可以大大提升应用的加载速度和性能。懒加载主要通过Webpack的代码分割功能实现&#xff0c;特别是使用动态导入&#xff08;import()语法&#xff09;。 为什么要使用懒加载&#xf…

C# new Bitmap(32043, 32043, PixelFormat.Format32bppArgb)报错:参数无效,如何将图像分块化处理?

C#处理非常大的图像&#xff08;如 32043x32043 像素&#xff09;时&#xff0c;确实需要采取分块化处理的方法来避免内存不足的问题。分块化处理可以将大图像分割成多个较小的块&#xff0c;分别进行处理和保存&#xff0c;最后再合并这些块以形成完整的图像。以下是一个详细的…

如何使用极狐GitLab 的外部状态检查功能?

极狐GitLab 是 GitLab 在中国的发行版&#xff0c;关于中文参考文档和资料有&#xff1a; 极狐GitLab 中文文档极狐GitLab 中文论坛极狐GitLab 官网 外部状态检查 (ULTIMATE ALL) pending 状态引入于极狐GitLab 16.5 pending 状态检查的超时时间为两分钟引入于极狐GitLab 16…

深入探索Spark-Streaming:从Kafka数据源创建DStream

在大数据处理领域&#xff0c;Spark-Streaming是一个强大的实时流处理框架&#xff0c;而Kafka作为高性能的分布式消息队列&#xff0c;二者结合能实现高效的数据处理。今天就来聊聊Spark-Streaming中从Kafka数据源创建DStream的相关知识。 早期&#xff0c;Spark-Streaming通过…

Kafka 详解

1.基本概念&#xff1a;Kafka 是分布式发布 - 订阅消息系统&#xff0c;具有高吞吐量、可扩展性等优势&#xff0c;支持点对点和发布订阅两种消息模式&#xff0c;涉及 Broker、Topic、Partition 等多种角色。 2.安装步骤&#xff1a;需先安装 JDK 和 Zookeeper&#xff0c;下…

uniapp-商城-34-shop 购物车 选好了 进行订单确认整体

在shop页面选中商品添加到购物车&#xff0c;可选好后&#xff0c;进行确认和支付。具体呈现在shop页面。 1 购物车栏 shop页面代码&#xff1a; 购物车代码&#xff1a; 代码&#xff1a; <template><view><view class"carlayout"><!-- 车里…

数据仓库是什么?数据仓库架构有哪些?

目录 数据仓库是什么&#xff1f;数据仓库架构有哪些&#xff1f; 一、数据仓库是什么&#xff1f; 二、数据仓库的架构分层 1. 获取层 2. 数据层 3. 应用层 4. 访问层 三、数据仓库的价值体现 1.决策支持 2.业务优化 3.提升竞争力 四、数据仓库的未来发展趋势 总…

单片机——使用printf调试

配置printf()输出函数 1、来自于<stdio.h> 2、运行C语言时&#xff0c;输出到终端 3、单片机没有终端&#xff0c;需要使用串口&#xff0c;将要输出的内容传到电脑&#xff08;串口调试助手&#xff09;上 例子如下 #include <stdio.h> #include &qu…

人脸识别考勤系统实现教程:基于Face-Recognition、OpenCV与SQLite

引言 随着人工智能技术的飞速发展&#xff0c;人脸识别技术已广泛应用于安防、金融、教育等多个领域。本文将带领大家利用Python的face-recognition库、OpenCV和SQLite数据库&#xff0c;从零开始构建一个具备异常报警功能的人脸识别考勤系统。该系统能够实时检测视频流中的人…

亲测成功❗❗❗Linux下编译opencv-4.10.0(静态链接库和动态链接库)

1. 安装依赖 在编译之前&#xff0c;确保系统中安装了必要的依赖工具和库。运行以下命令安装&#xff1a; sudo apt update sudo apt-get install build-essential sudo apt-get install cmake git libgtk2.0-dev pkg-config sudo apt-get install libavcodec-dev libavforma…

windows 部署Prometheus+Node-expoter

Prometheus v3.2.1 离线部署方式 通过helm部署prometheus会自动部署Node-expoter只需要添加prometheus的抓取规则&#xff01;&#xff01; 删除&#xff1a; 清除之前安装的 Prometheus 如果你之前已经安装了 Prometheus&#xff0c;需要清除原有的 Prometheus 安装&#xf…

HTMLCSS实现网页轮播图

网页中轮播图区域的实现与解析 在现代网页设计中&#xff0c;轮播图是一种常见且实用的元素&#xff0c;能够在有限的空间内展示多个内容&#xff0c;吸引用户的注意力。下面将对上述代码中轮播图区域的实现方式进行详细介绍。 一、HTML 结构 <div class"carousel-c…

Linux:进程的概念

基本概念 课本概念&#xff1a;程序的一个可执行实例&#xff0c;正在执行的程序。 内核观点&#xff1a;担当分配系统资源实体。 当操作系统要执行程序时&#xff0c;也就是说操作系统要执行代码&#xff0c;但一个操作系统需要执行多个程序&#xff0c;而CPU只有一块&#xf…

前端基础之《Vue(10)—过滤器》

一、过滤器 1、作用 用于数据处理。 2、全局过滤器 使用Vue.filter(名称, val>{return newVal})定义。 在任何组件中都可以直接使用。 3、局部过滤器 使用选项&#xff0c;filters: {}定义&#xff0c;只能在当前组件中使用。 4、过滤器在Vue 3.0中已经淘汰了 5、过滤器…