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

总结一下今天的学习过程

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

sqlite: 不需要继承models.Model
class 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/sshd

hadoopsum=
hadoopPwd=

echo $hadoopsum
echo $hadoopPwd

function setupHadoopSalve(){

	allhadoopip=''
	for ((i=0;i<$hadoopsum;i++));
	do
	    allhadoopip+="\n192.168.2.1$i hadoop$i";
	done
	allhadoopip+="\n"
	
	echo $allhadoopip
	echo "/etc/hosts......."
	cat /etc/hosts
	
	cp /etc/hosts /root/hosts.new
	echo "/root/hosts.new........"
	cat /root/hosts.new
	
	for ss in `cat /root/hosts.new | grep hadoop | awk '{print $1}'`;
	do sed -i '/'$ss'.*/d' /root/hosts.new;
	done
	echo -e "$(cat /root/hosts.new)" > /etc/hosts
	
	cat /etc/hosts
	echo -e $allhadoopip >> /etc/hosts
	
	cd ~
	rm -rf /root/.ssh
	mkdir /root/.ssh
	
	expect -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 $hostname
		expect -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 
}
setupHadoopSalve

for ss in `ps -e | grep sshd | awk '{print $1}'`;
do
kill $ss;
done
/usr/sbin/sshd -D


激动的一天,明天加油!

你可能感兴趣的:(docker初识,docker云,shell,容器云,hadoop集群)