FileCoin是最近一份工作,在架构上属于IPFS的激励层。其中,IPFS全称为星际文件传输协议。
在实际工作中,主要内容如下:
一、根据官方文档编译生成二进制文件(源码开发语言为Golang和少量rust)
二、根据官方文档提示进行linux集群部署,这部分主要为ansible的运维代码编写
三、对源码中效率较低的调度进行优化
四、对运行过程中产生的bug进行解决
https://lotus.filecoin.io/docs/set-up/install/#software-dependencies
- hosts: "{{ host }}" become: yes tasks: - name: 格式化设备为 raid0 + xfs shell: | local -a disks=($(fdisk -l | grep Disk | grep /dev/ | grep TiB | awk '{print $2}' | sed 's/://' | grep 'nv' | sort)) (( $#disks <= 1 )) && return 1 echo y | mdadm --create --verbose --level=0 --metadata=1.2 --raid-devices=$#disks --chunk=512K /dev/md/raid0 $disks mdadm --detail --scan >> /etc/mdadm.conf mkfs.xfs -f -L myraid0 /dev/md/raid0 mkdir -p /lotus/raid0 echo "# ==== generated by formating_ssd at $(date +%c) ====" >> /etc/fstab echo "LABEL=myraid0 /lotus/raid0 xfs defaults,largeio,swalloc 0 0" >> /etc/fstab echo "# ==== END ====" >> /etc/fstab mount -a chown -R XX:XX /lotus mv /lotus/cache /lotus/raid0/lotus_cache ln -s /lotus/raid0/lotus_cache /lotus/cache args: executable: /usr/bin/zsh
/************************************************************************ 功能: 定时检测raid0是否掉盘并修复 默认每2分钟执行一次 时间: 2021/8/27 **************************************************************************/ package main import ( "flag" "log" "os" "os/exec" "strings" "time" ) const ( INTERVAL = 120 //单位:秒 PATH = "/lotus/raid0" MD = "/dev/md/raid0" BASH = "/bin/bash" ) func multi_cmd_lines(path string, md string) string { return strings.Join([]string{ "systemctl stop lotus-worker", "umount " + path, "xfs_repair " + md, "mount -a", "umount " + path, "xfs_repair " + md, "mount -a", "systemctl start lotus-worker", }, ";") } func timer(interval time.Duration, path string, md string) { t := time.NewTicker(interval) for { go func(path string) { _, err := os.Stat(path) if err != nil { log.Println(err) cmd := exec.Command(BASH, "-c", multi_cmd_lines(path, md)) out, err := cmd.CombinedOutput() log.Println(string(out), err) } else { log.Println("正常检测raid0!") } }(path) <-t.C } } func main() { secs := flag.Int("time", INTERVAL, "- 输入检测间隔时间,单位:秒") //检测间隔时间(秒) path := flag.String("path", PATH, "- 输入raid0目录") md := flag.String("md", MD, "- 输入xfs修复目录") flag.Parse() go timer(time.Duration(*secs)*time.Second, *path, *md) select {} }
机房/深圳坂田:https://filfox.info/zh/address/f01167426
区块链知识
Golang二进制编译、部分优化
linux运维、shell编程、ansible运维
Golang小程序修复故障
整体难度比较大,需要对linux非常熟练