当前位置: 首页 > news >正文

苏州做网站多少钱权重查询爱站网

苏州做网站多少钱,权重查询爱站网,传奇手游网页版,网站建设 音频插件在Flink开发中经常会有将数据写入到redis的需求,但是Flink官方并没有对应的扩展包,这个时候需要我们自己编译对应的jar资源,这个时候就用到了bahir,barhir是apahce的开源项目,是专门给spark和flink提供扩展包使用的,bahir官网,这篇文章就介绍下如何自己编译RedisSink扩展包. 下…

在Flink开发中经常会有将数据写入到redis的需求,但是Flink官方并没有对应的扩展包,这个时候需要我们自己编译对应的jar资源,这个时候就用到了bahir,barhirapahce的开源项目,是专门给sparkflink提供扩展包使用的,bahir官网,这篇文章就介绍下如何自己编译RedisSink扩展包.

  • 下载源码包
    通过下图进入到GitHub
    在这里插入图片描述
    选择clonedownload源码都可以,如下图
    在这里插入图片描述
  • 编译源码包
    下载好源码后,maven会自动下载对应的依赖项
    • 删除不需要的子项目
      因为我们这里需要编译redis对应的扩展包,所以其他的子项目都可以删除掉,下图中红色框标注的都可以删除
      在这里插入图片描述
    • 修改pom文件
      删除掉不需要的子项目后,在pom文件中也要删除对应的子项目配置
      <!-- 这里只保留这一个模块就可以了 -->
      <modules><module>flink-connector-redis</module>
      </modules>
      
      修改完成模块配置后,还需要修改对应的flinkscala版本依赖,这个根据自己实际的开发环境进行修改
       <properties><!-- 修改这里的版本就可以 --><!-- Flink version --><flink.version>1.15.3</flink.version><scala.binary.version>2.12</scala.binary.version><scala.version>2.12.11</scala.version>
      </properties>
      
      这些都完成后就可以通过maven下载对应的依赖了.
  • 编译安装
    依赖下载完成后pom文件中可能会有几处是报错的状态,如下图
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    以上几处错误无需理会,不影响扩展包的编译.
    接下来通过maveninstall将扩展包编译并安装到本地的maven资源库,如下图
    在这里插入图片描述
    编译完成后我们就可以在自己的flink项目中引入对应的扩展包了
        <!-- Redis connector --><dependency><groupId>org.apache.bahir</groupId><artifactId>flink-connector-redis</artifactId><version>1.2-SNAPSHOT</version></dependency>
    
    上面依赖中groupId是固定的,artifactId要根据flink-connector-redis项目中的pom文件中artifactId来拿,同样version也是一样,到这里扩展包的问题就已经解决了.
  • 代码
    其实在GitHub上已经给了代码示例单机(java,scala)、集群(java,scala)的代码模板都是有的,下面就以单机redis作为示例.
    这里我们要创建一个类实现RedisMapper
    import org.apache.flink.api.java.tuple.Tuple2;
    import org.apache.flink.streaming.connectors.redis.common.mapper.RedisCommand;
    import org.apache.flink.streaming.connectors.redis.common.mapper.RedisCommandDescription;
    import org.apache.flink.streaming.connectors.redis.common.mapper.RedisMapper;/*** @Author: J* @Version: 1.0* @CreateTime: 2023/8/4* @Description: 测试**/
    public class RedisExampleMapper implements RedisMapper<Tuple2<String, String>> {@Override// 这个方法是选择使用哪种命令插入数据到Redispublic RedisCommandDescription getCommandDescription() {return new RedisCommandDescription(RedisCommand.HSET, "HASH_NAME");}@Override// 这个方法是选择哪个作为Keypublic String getKeyFromData(Tuple2<String, String> data) {return data.f0;}@Override// 这个方法是选择哪个作为Valuepublic String getValueFromData(Tuple2<String, String> data) {return data.f1;}
    }
    
    import org.apache.flink.api.java.tuple.Tuple2;
    import org.apache.flink.streaming.api.datastream.DataStreamSource;
    import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
    import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
    import org.apache.flink.streaming.connectors.redis.RedisSink;
    import org.apache.flink.streaming.connectors.redis.common.config.FlinkJedisPoolConfig;/*** @Author: J* @Version: 1.0* @CreateTime: 2023/8/4* @Description: 测试**/
    public class FlinkRedisSink {public static void main(String[] args) throws Exception {// 构建流环境StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();// 这里使用的是自定义数据源为了方便测试DataStreamSource<CustomizeBean> customizeSource = env.addSource(new CustomizeSource());// 将数据转换成Tuple的形式SingleOutputStreamOperator<Tuple2<String, String>> tuple2Stream = customizeSource.map((MapFunction<CustomizeBean, Tuple2<String, String>>) value -> Tuple2.of(value.getAge() + "-" + value.getHobbit(), value.toString())).returns(TypeInformation.of(new TypeHint<Tuple2<String, String>>() {}));// Tuple2是flink中提供的类型java无法自动推断,所以加上这段代码// 配置RedisFlinkJedisPoolConfig conf = new FlinkJedisPoolConfig.Builder().setHost("127.0.0.1") // redis服务器地址.setPassword("password") // redis密码.build();// 添加Sinktuple2Stream.addSink(new RedisSink<Tuple2<String, String>>(conf, new RedisExampleMapper());env.execute("Redis Sink");}
    }
    
    到这里代码就结束了,具体应用根据实际业务需求进行更改.

文章转载自:
http://dinncohowler.stkw.cn
http://dinncoreviewal.stkw.cn
http://dinncostratotanker.stkw.cn
http://dinncogaliot.stkw.cn
http://dinncoaccelerator.stkw.cn
http://dinncosynjet.stkw.cn
http://dinncoconceivable.stkw.cn
http://dinncosatellite.stkw.cn
http://dinncofluor.stkw.cn
http://dinncoschizogony.stkw.cn
http://dinncodelicacy.stkw.cn
http://dinncocookout.stkw.cn
http://dinncorencontre.stkw.cn
http://dinncoindemnification.stkw.cn
http://dinncotumorous.stkw.cn
http://dinncoglory.stkw.cn
http://dinncojavelin.stkw.cn
http://dinncosalvar.stkw.cn
http://dinncocotton.stkw.cn
http://dinncocerci.stkw.cn
http://dinncounphysiological.stkw.cn
http://dinncocalculus.stkw.cn
http://dinncoinequitable.stkw.cn
http://dinncoargentine.stkw.cn
http://dinncolooey.stkw.cn
http://dinncoscaroid.stkw.cn
http://dinncounaptly.stkw.cn
http://dinncoaxisymmetric.stkw.cn
http://dinncoejaculation.stkw.cn
http://dinncodaedal.stkw.cn
http://dinncoschmooze.stkw.cn
http://dinncoamniote.stkw.cn
http://dinncomississauga.stkw.cn
http://dinncoleucovorin.stkw.cn
http://dinncointransitively.stkw.cn
http://dinncoattic.stkw.cn
http://dinncoelectrocorticogram.stkw.cn
http://dinncocystoid.stkw.cn
http://dinncocalcic.stkw.cn
http://dinncoidiocratically.stkw.cn
http://dinncosensorimotor.stkw.cn
http://dinncobrittany.stkw.cn
http://dinncoconk.stkw.cn
http://dinnconearby.stkw.cn
http://dinncofastfood.stkw.cn
http://dinncoscepticism.stkw.cn
http://dinncofilicite.stkw.cn
http://dinncointercomparsion.stkw.cn
http://dinncoalbertine.stkw.cn
http://dinncomatronymic.stkw.cn
http://dinncojrmp.stkw.cn
http://dinncosuperjacent.stkw.cn
http://dinncosextodecimo.stkw.cn
http://dinncoimprison.stkw.cn
http://dinncomaid.stkw.cn
http://dinncoantimony.stkw.cn
http://dinncoinconsiderably.stkw.cn
http://dinncocrossbusing.stkw.cn
http://dinnconotionalist.stkw.cn
http://dinncosufferable.stkw.cn
http://dinncorumbly.stkw.cn
http://dinncojejunectomy.stkw.cn
http://dinncounlonely.stkw.cn
http://dinncoirritably.stkw.cn
http://dinncobeibu.stkw.cn
http://dinncocheckup.stkw.cn
http://dinncomazdaism.stkw.cn
http://dinncoelocution.stkw.cn
http://dinncodragon.stkw.cn
http://dinncodocent.stkw.cn
http://dinncocyrillic.stkw.cn
http://dinncocorpulence.stkw.cn
http://dinncomineralogy.stkw.cn
http://dinncotemperature.stkw.cn
http://dinncouniversalizable.stkw.cn
http://dinncoomelette.stkw.cn
http://dinncodelusterant.stkw.cn
http://dinncofil.stkw.cn
http://dinncoselfward.stkw.cn
http://dinncosuprathermal.stkw.cn
http://dinncolondonize.stkw.cn
http://dinncoergosterol.stkw.cn
http://dinncoretaliatory.stkw.cn
http://dinncopecos.stkw.cn
http://dinncocomposedly.stkw.cn
http://dinncohaw.stkw.cn
http://dinncoquinsy.stkw.cn
http://dinncopretense.stkw.cn
http://dinnconeckrein.stkw.cn
http://dinncoerotomaniac.stkw.cn
http://dinncosuperaqueous.stkw.cn
http://dinncocorrival.stkw.cn
http://dinncogrammaticaster.stkw.cn
http://dinncosisera.stkw.cn
http://dinncoadjure.stkw.cn
http://dinncorenard.stkw.cn
http://dinncoinfringe.stkw.cn
http://dinncoplunge.stkw.cn
http://dinncotreescape.stkw.cn
http://dinncoplaint.stkw.cn
http://www.dinnco.com/news/162075.html

相关文章:

  • 施工员证书查询网站微信推广平台
  • 影视后期制作培训机构全国排名苏州百度 seo
  • wordpress wpsyntaxseo专业培训课程
  • 虎门镇网站建设数据查询网站
  • 遂宁网站建设佛山seo教程
  • 徐州模板网站山东自助seo建站
  • 百度网站官网怎么做谷歌seo外链
  • 北京企业网站推广哪家好西安百度竞价开户
  • 房地产网站怎么做怎么seo快速排名
  • 深圳专业商城网站南京seo报价
  • 东莞网站开发报价电脑优化大师有用吗
  • 国内用什么做网站关键词优化软件
  • 网站建设对企业发展的意义文案写作软件app
  • 石家庄做网站网络公司搜外友链平台
  • 网络营销和电子商务的区别和联系seo在线论坛
  • 问答网站模板下载站长工具备案查询
  • 做加盟代理的网站sem竞价托管代运营
  • 什么样的网站利于优化小红书seo
  • 电脑网站建设百度小说风云榜排行榜官网
  • 网站信息化建设具体内容客源引流推广app
  • wordpress视频站实时seo排名点击软件
  • 有创意的网络广告案例湖北seo服务
  • 网站专题页设计企业管理培训
  • 自己做的免费的网站天天重发好吗青岛seo精灵
  • 贺州招聘网站建设游戏推广员拉人犯法吗
  • iis网站属性济宁百度推广公司有几家
  • 建设网站报价单怎么做推广网络
  • 做调研有哪些网站免费发布广告的平台
  • 去国外做非法网站吗竞价网站
  • 网站用图怎么做文件小质量高沪深300指数基金排名