http://ask.loongnix.org/?/article/93

etcd 是一个应用在分布式环境下的 key/value 存储服务。

由于Kubernetes要使用到etcd,所以第一步就是进行etcd的搭建。
 
etcd是一个Go语言编写的软件。

搭建环境
 
本文的实验都是在龙芯3A3000机器上。
操作系统是loongnix(Fedora21)20170512版本。
GO版本:go1.7.5 linux/mips64le
 
开始搭建
 
首先打开终端,配置GOPATH

# export GOPATH=/usr/lib/golang

进入GOPATH目录下

# cd $GOPATH

在$GOPATH的src目录下创建嵌套文件夹github.com/coreos

# mkdir -p $GOPATH/src/github.com/coreos

进入创建的文件夹下

# cd $GOPATH/src/github.com/coreos

下载etcd 2.3.6版本

# git clone  -b  v2.3.6 https://github.com/coreos/etcd.git

进入下载的etcd 文件夹下

# cd etcd

开始编译

# ./build

出现如下错误

github.com/coreos/etcd/Godeps/_workspace/src/github.com/boltdb/bolt
Godeps/_workspace/src/github.com/boltdb/bolt/db.go:98: undefined: maxMapSize
Godeps/_workspace/src/github.com/boltdb/bolt/db.go:98: invalid array bound maxMapSize

根据maxMapSize关键字找原因,使用grep "maxMapSize"  ./* -r 找出路径

# grep "maxMapSize" ./* -r

搜索出如下内容

./Godeps/_workspace/src/github.com/boltdb/bolt/db.go:  data     *[maxMapSize]byte
./Godeps/_workspace/src/github.com/boltdb/bolt/db.go:   if size > maxMapSize {
./Godeps/_workspace/src/github.com/boltdb/bolt/db.go:   if sz > maxMapSize {
./Godeps/_workspace/src/github.com/boltdb/bolt/db.go:       sz = maxMapSize
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_windows.go: db.data = ((*[maxMapSize]byte)(unsafe.Pointer(addr)))
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_386.go:// maxMapSize represents the largest mmap size supported by Bolt.
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_386.go:const maxMapSize = 0x7FFFFFFF // 2GB
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_amd64.go:// maxMapSize represents the largest mmap size supported by Bolt.
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_amd64.go:const maxMapSize = 0xFFFFFFFFFFFF // 256TB
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_ppc64le.go:// maxMapSize represents the largest mmap size supported by Bolt.
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_ppc64le.go:const maxMapSize = 0xFFFFFFFFFFFF // 256TB
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_unix_solaris.go:    db.data = (*[maxMapSize]byte)(unsafe.Pointer(&b[0]))
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_arm64.go:// maxMapSize represents the largest mmap size supported by Bolt.
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_arm64.go:const maxMapSize = 0xFFFFFFFFFFFF // 256TB
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_s390x.go:// maxMapSize represents the largest mmap size supported by Bolt.
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_s390x.go:const maxMapSize = 0xFFFFFFFFFFFF // 256TB
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_arm.go:// maxMapSize represents the largest mmap size supported by Bolt.
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_arm.go:const maxMapSize = 0x7FFFFFFF // 2GB
./Godeps/_workspace/src/github.com/boltdb/bolt/bolt_unix.go:    db.data = (*[maxMapSize]byte)(unsafe.Pointer(&b[0]))

根据错误提示分析,是因为在 ./Godeps/_workspace/src/github.com/boltdb/bolt 文件夹下,
缺少了支持mips64le平台的文件。
进入这个目录下添加bolt_mips64le.go文件:

# cd ./Godeps/_workspace/src/github.com/boltdb/bolt
# cp bolt_arm.go  bolt_mips64le.go

重新进入etcd文件夹下,开始编译

# cd $GOPATH/src/github.com/coreos/etcd
# ./build

出现如下错误

2017-11-02 11:58:50.257747 E | etcdmain: etcd on unsupported platform without ETCD_UNSUPPORTED_ARCH=mips64le set.

这是因为没有配置ETCD_UNSUPPORTED_ARCH环境变量
配置环境变量

# export ETCD_UNSUPPORTED_ARCH=mips64le

再次编译

# ./build

执行通过,在etcd文件夹里会生成bin文件夹,进入bin文件夹

# cd bin 

把bin文件夹下的etcd、etcdctl两个文件拷贝到/usr/bin文件夹下

# cp etcd  /usr/bin/
# cp etcdctl /usr/bin/

进入/usr/bin下

# cd /usr/bin

执行测试

执行etcd文件

# ./etcd
2017-11-02 19:57:52.098590 W | etcdmain: running etcd on unsupported architecture "mips64le" since ETCD_UNSUPPORTED_ARCH is set
2017-11-02 19:57:52.099742 W | flags: unrecognized environment variable ETCD_UNSUPPORTED_ARCH=mips64le
2017-11-02 19:57:52.099870 I | etcdmain: etcd Version: 2.3.6
2017-11-02 19:57:52.099924 I | etcdmain: Git SHA: 128344c
2017-11-02 19:57:52.099974 I | etcdmain: Go Version: go1.7.5
2017-11-02 19:57:52.100021 I | etcdmain: Go OS/Arch: linux/mips64le
2017-11-02 19:57:52.100074 I | etcdmain: setting maximum number of CPUs to 4, total number of available CPUs is 4
2017-11-02 19:57:52.100145 W | etcdmain: no data-dir provided, using default data-dir ./default.etcd
2017-11-02 19:57:52.101051 I | etcdmain: listening for peers on http://localhost:2380
2017-11-02 19:57:52.101273 I | etcdmain: listening for peers on http://localhost:7001
2017-11-02 19:57:52.101483 I | etcdmain: listening for client requests on http://localhost:2379
2017-11-02 19:57:52.101683 I | etcdmain: listening for client requests on http://localhost:4001
2017-11-02 19:57:52.105386 I | etcdserver: name = default
2017-11-02 19:57:52.105674 I | etcdserver: data dir = default.etcd
2017-11-02 19:57:52.105741 I | etcdserver: member dir = default.etcd/member
2017-11-02 19:57:52.105794 I | etcdserver: heartbeat = 100ms
2017-11-02 19:57:52.105845 I | etcdserver: election = 1000ms
2017-11-02 19:57:52.105896 I | etcdserver: snapshot count = 10000
2017-11-02 19:57:52.105968 I | etcdserver: advertise client URLs = http://localhost:2379,http://localhost:4001
2017-11-02 19:57:52.106025 I | etcdserver: initial advertise peer URLs = http://localhost:2380,http://localhost:7001
2017-11-02 19:57:52.106204 I | etcdserver: initial cluster = default=http://localhost:2380,default=http://localhost:7001
2017-11-02 19:57:52.115937 I | etcdserver: starting member ce2a822cea30bfca in cluster 7e27652122e8b2ae
2017-11-02 19:57:52.116104 I | raft: ce2a822cea30bfca became follower at term 0
2017-11-02 19:57:52.116172 I | raft: newRaft ce2a822cea30bfca [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2017-11-02 19:57:52.116223 I | raft: ce2a822cea30bfca became follower at term 1
2017-11-02 19:57:52.116829 I | etcdserver: starting server... [version: 2.3.6, cluster version: to_be_decided]
2017-11-02 19:57:52.118591 E | etcdmain: failed to notify systemd for readiness: No socket
2017-11-02 19:57:52.118642 E | etcdmain: forgot to set Type=notify in systemd service file?
2017-11-02 19:57:52.119456 N | etcdserver: added local member ce2a822cea30bfca [http://localhost:2380 http://localhost:7001] to cluster 7e27652122e8b2ae
2017-11-02 19:57:52.516914 I | raft: ce2a822cea30bfca is starting a new election at term 1
2017-11-02 19:57:52.517204 I | raft: ce2a822cea30bfca became candidate at term 2
2017-11-02 19:57:52.517241 I | raft: ce2a822cea30bfca received vote from ce2a822cea30bfca at term 2
2017-11-02 19:57:52.517327 I | raft: ce2a822cea30bfca became leader at term 2
2017-11-02 19:57:52.517369 I | raft: raft.node: ce2a822cea30bfca elected leader ce2a822cea30bfca at term 2
2017-11-02 19:57:52.518315 I | etcdserver: published {Name:default ClientURLs:[http://localhost:2379 http://localhost:4001]} to cluster 7e27652122e8b2ae
2017-11-02 19:57:52.518664 I | etcdserver: setting up the initial cluster version to 2.3
2017-11-02 19:57:52.525866 N | etcdserver: set the initial cluster version to 2.3

再另一个终端中测试

# etcdctl set /foo/bar  “hello world”

输出“hello world”说明启动成功。
 
这样,etcd就搭建成功了,整个过程还是很简单的,改动的代码不算多,运行也比较顺利。
 
后面将继续移植Kubernetes,好期待啊!

龙芯3A3000搭建分布式存储服务etcd相关推荐

  1. come type6 定义_COMe-B6101龙芯3A3000 COM Express Type6模块

    COMe-B6101是一款以龙芯3A多核处理器和AMD RS780E SB710芯片组为核心,高可靠性和高效能的主板模块.COMe-B6101 内部集成ATI M72-based图像引擎,支持双屏显示 ...

  2. 龙芯服务器部署WEB服务的体验和详细步骤

    http://www.loongson.cn/news/company/511.html 2016年8月,通过龙芯俱乐部的<龙芯团购>(网址http://www.loongsonclub. ...

  3. 龙芯3A5000搭建idea开发环境

    国产化处理器龙芯3A5000,操作系统loongnix,安装操作系统后自带了jdk1.8,下载idea安装包以后无法运行idea开发工具,报错: root@xxx-loongson:/opt/idea ...

  4. 走进龙芯3A3000(四)安装XFCE4

    我想要安装KDE 我想要qtwebengine的MIPS64实现.曾经读过千里孤坟的<KDE综览>,就深深喜欢上了KDE,当时的版本还是KDE3.后来KDE4发布,千里孤坟又写了<K ...

  5. Linux内核4.10在龙芯3A3000笔记本上的移植

    http://ask.loongnix.org/?/article/66 http://ask.loongnix.org/?/article/67 http://ask.loongnix.org/?/ ...

  6. 使用buildroot构建龙芯2K1000文件系统,并使用qt+OpenCV进行拍照,并使用dropbear搭建ssh服务

    使用buildroot构建龙芯2K1000文件系统 准备工作(下载buildroot) https://buildroot.org/download.html 进入目录,使用make menuconf ...

  7. 龙芯电脑平台kubernetes集群编译及部署方案

    http://ask.loongnix.org/?/article/105  一.环境 操作系统: loongnix 内核: 3.10.84 go版本: go1.9.2 linux/mips64le ...

  8. 龙芯交叉编译环境搭建之交叉编译工具链配置

     龙芯交叉编译环境搭建之 交叉编译工具链配置 1 概括 本文档适用于龙芯3A3000/4000 UEFI代码编译,重点指导交叉编译环境的搭建方法,对系统安装不做介绍. Ubuntu系统(版本为ubun ...

  9. 国产六大CPU:飞腾、鲲鹏、龙芯、海光、申威、兆芯

    CPU 是计算机系统的核心和大脑  CPU,即中央处理器是计算机的运算和控制核心,其功能主要是解释计算机指令以及处理计算机软件中的数据.CPU 主要由控制器.运算器.存储器和连接总线构成.其中,控制 ...

  10. 【转帖】龙芯将两款 CPU 核开源,这意味着什么?

    龙芯将两款 CPU 核开源,这意味着什么? https://www.oschina.net/news/78316/loongson-open-source-two-cpu-core 文章挺不错的也讲了 ...

最新文章

  1. linux异常 - 无法分配内存
  2. 顺序表应用4:元素位置互换之逆置算法
  3. 门槛回归模型_stata15:门槛模型
  4. linux正则表达式脚本实例,shell脚本专题二.正则表达式和文件操作
  5. spring整合shiro
  6. Windows Server 2008 R2正式版尝鲜体验
  7. asp+access实现增删改查
  8. 盘点人工智能十大经典应用领域、图解技术原理
  9. 港大HKU邮箱(connect.hku.hk)添加至iphone 自带邮箱方法
  10. 多线程编程之Linux环境下的多线程(三)——好文
  11. Tensorflow-slim 做扑克,麻将,花牌的分类
  12. AtCoder ABC161 E - Yutori
  13. 关于NXP 汽车ABS ASIC芯片BA13系列轮速部分驱动
  14. ECCV 2022 旷视入选论文亮点解读(下)
  15. python mpi开销_基于Python的MPI
  16. 《植物大战僵尸OL》中国植物曝光
  17. nacos 2.0.2 下载
  18. 自动驾驶毫米波雷达物体检测技术-硬件
  19. 机房服务器招标文件,网络服务器中心机房招标技术文件.doc
  20. Delph 表格数据导出方法汇总

热门文章

  1. 4 基于pyecharts的python数据可视化——散点图和折线图的绘制
  2. 主流编程语言的介绍及特点
  3. 【技巧】谷歌Chrome浏览器清理缓存的两种方式
  4. 图像质量评估---FID
  5. POI 导出Excel文件 设置指定列格式为文本格式
  6. 【浏览器强制360网页导航】360导航被强制设成首页如何取消?
  7. 取消360导航作为浏览器访问首页
  8. 使用prettier统一编码风格
  9. 从ToC到ToB,疫情给我们的影响是什么?
  10. php倒入百万行excel数据,PHP导入(百万级)Excel表格数据