shell脚本在容器云中搭建hadoop集群(四)

来源:互联网 发布:写给大家看的c语言书 编辑:程序博客网 时间:2024/06/07 02:27

总结一下今天的学习过程

1,上午继续观看学习Python的数据库编程视屏,测试Django项目使用MariaDB数据库,由列表实现数据库表的映射,总结了区别

sqlite: 不需要继承models.Modelclass student01():    id = models.IntegerField(primary_key=True)    name = models.CharField(max_length=50)    adress = models.CharField(max_length=50)    class Meta:        db_table='student01'MariaDB:class User(models.Model):    id = models.AutoField(max_length=11,db_column='UID',primary_key=True)    userName = models.CharField(max_length=255,db_column='username',blank = False)    passWord = models.CharField(max_length=255,db_column='password',blank = False)    cid = models.IntegerField(max_length=11,db_column='CID',blank = False)    class Meta:        db_table = 'user'testDB.User.cid: (fields.W122) 'max_length' is ignored when used with IntegerField设置为整形integer,长度不生效

2,中午以及下午还有晚上陆陆续续的师弟师妹来到实验室,感觉队伍又壮大了

3,今天师兄返校,倍感激动,请教了我之前做的使用shell脚本在docker中搭建hadoop的问题:关于sshd服务开启、hadoop容器之间相互免密登录的问题,实现了从节点的sshd以及其的ssh免密登录,感觉看到了曙光,期待明天能有更多的进展。

# !/bin/bash# start sshd/usr/sbin/sshdhadoopsum=hadoopPwd=echo $hadoopsumecho $hadoopPwdfunction setupHadoopSalve(){allhadoopip=''for ((i=0;i<$hadoopsum;i++));do    allhadoopip+="\n192.168.2.1$i hadoop$i";doneallhadoopip+="\n"echo $allhadoopipecho "/etc/hosts......."cat /etc/hostscp /etc/hosts /root/hosts.newecho "/root/hosts.new........"cat /root/hosts.newfor ss in `cat /root/hosts.new | grep hadoop | awk '{print $1}'`;do sed -i '/'$ss'.*/d' /root/hosts.new;doneecho -e "$(cat /root/hosts.new)" > /etc/hostscat /etc/hostsecho -e $allhadoopip >> /etc/hostscd ~rm -rf /root/.sshmkdir /root/.sshexpect -c "set timeout -1;        spawn ssh-keygen -t rsa;        expect {    *(y/n)* {send -- y\r;exp_continue;}            *Enter* {send -- \r;exp_continue;}        }";expect -c "set timeout -1;spawn ssh-copy-id localhost;expect {*(yes/no)* {send -- yes\r;exp_continue;}*assword:* {send -- $hadoopPwd\r;exp_continue;}eof        {exit 0;}}";for hostname in `hostname`;do    echo $hostnameexpect -c "set timeout -1;spawn ssh-copy-id $hostname;expect {*(yes/no)* {send -- yes\r;exp_continue;}*assword:* {send -- $hadoopPwd\r;exp_continue;}eof        {exit 0;}}";done }setupHadoopSalvefor ss in `ps -e | grep sshd | awk '{print $1}'`;dokill $ss;done/usr/sbin/sshd -D


激动的一天,明天加油!

原创粉丝点击