栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在Linux上使用confluent-kafka-go构建Go应用程序

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在Linux上使用confluent-kafka-go构建Go应用程序

几周前我也遇到过类似的问题。IIRC

confluent-kafka-go
需要最新版本的
librdkafka-dev
,但尚未发布给高山或其他人。虽然我能够为ubuntu找到它,所以我的解决方案(它比我期望的要复杂得多,但它确实有效)是从干净的ubuntu开始,安装
librdkafka-dev
,安装我想要的Go版本并在docker中编译。

外观如下:

FROM ubuntu# Install the C lib for kafkaRUN apt-get updateRUN apt-get install -y --no-install-recommends apt-utils wget gnupg software-properties-commonRUN apt-get install -y apt-transport-https ca-certificatesRUN wget -qO - https://packages.confluent.io/deb/5.1/archive.key | apt-key add -RUN add-apt-repository "deb [arch=amd64] https://packages.confluent.io/deb/5.1 stable main"RUN apt-get updateRUN apt-get install -y librdkafka-dev# Install GoRUN add-apt-repository ppa:longsleep/golang-backportsRUN apt-get updateRUN apt-get install -y golang-1.11-go# build the libraryWORKDIR /go/src/gitlab.appsflyer.com/rantav/kafka-mirror-testerCOPY *.go ./COPY // the rest of your go files. You may copy recursive if you wantCOPY vendor vendorRUN GOPATH=/go GOOS=linux /usr/lib/go-1.11/bin/go build -a -o main .EXPOSE 8000ENTRYPOINT ["./main"]


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/484383.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号