Ejemplo n.º 1
0
def set_client_hostname():
    ip = all_ip.client_ip()
    getoutput("ssh {}.{}.{}.{} hostnamectl set-hostname c1.com".format(
        ip[0], ip[1], ip[2], ip[3]))
    #getoutput("ssh {0}.{1}.{2}.{3} echo '{0}.{1}.{2}.{3} m1.com' >> /etc/hosts".format(ip[0],ip[1],ip[2],ip[3]))
    getoutput(
        "echo '{0}.{1}.{2}.{3} c1.com' >> /root/Desktop/project/task0/hosts".
        format(ip[0], ip[1], ip[2], ip[3]))
Ejemplo n.º 2
0
def tasktrackerconf():

    ip = all_ip.slaves_ip()

    for i in range(len(ip)):
        getoutput(
            "scp /root/Desktop/project/task0/mapred-site.xml {}.{}.{}.{}:/etc/hadoop/"
            .format(ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
Ejemplo n.º 3
0
def slaveconf():
    ip = all_ip.slaves_ip()

    for i in range(len(ip)):
        getoutput(
            "scp /root/Desktop/project/task0/hdfs-site2.xml {}.{}.{}.{}:/etc/hadoop/hdfs-site.xml"
            .format(ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
        getoutput(
            "scp /root/Desktop/project/task0/core-site.xml {}.{}.{}.{}:/etc/hadoop/hdfs-site.xml"
            .format(ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
Ejemplo n.º 4
0
def clientconf():

    ip = all_ip.client_ip()

    getoutput(
        "scp /root/Desktop/project/task0/core-site.xml {}.{}.{}.{}:/etc/hadoop/"
        .format(ip[0], ip[1], ip[2], ip[3]))

    getoutput(
        "scp /root/Desktop/project/task0/mapred-site.xml {}.{}.{}.{}:/etc/hadoop/"
        .format(ip[0], ip[1], ip[2], ip[3]))
Ejemplo n.º 5
0
def set_slaves_hostname():
    ip = all_ip.slaves_ip()

    for i in range(len(ip)):

        print(ip[i])
        getoutput("ssh {}.{}.{}.{} hostnamectl set-hostname s{}.com".format(
            ip[i][0], ip[i][1], ip[i][2], ip[i][3], i + 1))
        #getoutput("ssh {0}.{1}.{2}.{3} echo '{0}.{1}.{2}.{3} m{4}.com' >> /etc/hosts".format(ip[0],ip[1],ip[2],ip[3],i+1))
        getoutput(
            "echo '{}.{}.{}.{} s{}.com' >> /root/Desktop/project/task0/hosts".
            format(ip[i][0], ip[i][1], ip[i][2], ip[i][3], i + 1))
Ejemplo n.º 6
0
def hadoop_install_in_jobtracker():
    ip = all_ip.jobtracker_ip()
    a = getoutput("ssh {}.{}.{}.{} hadoop version".format(
        ip[0], ip[1], ip[2], ip[3]))
    if a == 0:
        pass
    else:
        getoutput(
            "scp /root/Desktop/project/task0/hadoop-1.2.1-1.x86_64.rpm {}.{}.{}.{}:"
            .format(ip[0], ip[1], ip[2], ip[3]))
        getoutput("ssh {}.{}.{}.{} rpm -ivh hadoop-1.2.1-1.x86_64.rpm --force".
                  format(ip[0], ip[1], ip[2], ip[3]))
Ejemplo n.º 7
0
def hadoop_install_in_slaves():
    ip = all_ip.slaves_ip()

    for i in range(len(ip)):
        a = getoutput("ssh {}.{}.{}.{} hadoop version".format(
            ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
        if a == 0:
            pass
        else:
            getoutput(
                "scp /root/Desktop/project/task0/hadoop-1.2.1-1.x86_64.rpm {}.{}.{}.{}:"
                .format(ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
            getoutput(
                "ssh {}.{}.{}.{} rpm -ivh hadoop-1.2.1-1.x86_64.rpm --force".
                format(ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
Ejemplo n.º 8
0
def masterconf():
	getoutput("clear")
	ip=all_ip.master_ip()

	#getoutput("ssh 192.168.43.{0} scp /root/Desktop/project/task0/hdfs-site.xml 192.168.43.{0}:/etc/hadoop/".format(ip))

	getoutput("scp /root/Desktop/project/task0/hdfs-site.xml {}.{}.{}.{}:/etc/hadoop/".format(ip[0],ip[1],ip[2],ip[3]))

	getoutput("scp /root/Desktop/project/task0/core-site.xml {}.{}.{}.{}:/etc/hadoop/".format(ip[0],ip[1],ip[2],ip[3]))
	
	getoutput("ssh {}.{}.{}.{} hadoop namenode -format".format(ip[0],ip[1],ip[2],ip[3]))
Ejemplo n.º 9
0
def jobtrackerconf():
	getoutput("clear")
	
	ip=all_ip.jobtracker_ip()

	getoutput("scp /root/Desktop/project/task0/mapred-site.xml {}.{}.{}.{}:/etc/hadoop/".format(ip[0],ip[1],ip[2],ip[3]))

	getoutput("scp /root/Desktop/project/task0/core-site.xml {}.{}.{}.{}:/etc/hadoop/".format(ip[0],ip[1],ip[2],ip[3]))
Ejemplo n.º 10
0
def java_install_in_client():
    ip = all_ip.client_ip()
    a = getoutput("ssh {}.{}.{}.{} java -version".format(
        ip[0], ip[1], ip[2], ip[3]))
    if a == 0:
        print("Java is already installed")
    else:
        getoutput(
            "scp /root/Desktop/project/task0/jdk-8u171-linux-x64.rpm {}.{}.{}.{}:"
            .format(ip[0], ip[1], ip[2], ip[3]))
        getoutput("ssh {}.{}.{}.{} rpm -ivh jdk-8u171-linux-x64.rpm".format(
            ip[0], ip[1], ip[2], ip[3]))
        getoutput(
            "scp /root/Desktop/project/task0/.bashrc {}.{}.{}.{}:".format(
                ip[0], ip[1], ip[2], ip[3]))
Ejemplo n.º 11
0
def java_install_in_master():
    ip = all_ip.master_ip()
    a = getoutput("ssh {}.{}.{}.{} java -version".format(
        ip[0], ip[1], ip[2], ip[3]))
    if a == 0:
        pass
    else:
        getoutput(
            "scp /root/Desktop/project/task0/jdk-8u171-linux-x64.rpm {}.{}.{}.{}:"
            .format(ip[0], ip[1], ip[2], ip[3]))
        getoutput("ssh {}.{}.{}.{} rpm -ivh jdk-8u171-linux-x64.rpm".format(
            ip[0], ip[1], ip[2], ip[3]))
        getoutput(
            "scp /root/Desktop/project/task0/.bashrc {}.{}.{}.{}:".format(
                ip[0], ip[1], ip[2], ip[3]))
Ejemplo n.º 12
0
def java_install_in_slaves():
    ip = all_ip.slaves_ip()

    for i in range(len(ip)):
        a = getoutput("ssh {}.{}.{}.{} java -version".format(
            ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
        if a == 0:
            print("Java is already installed")
        else:
            getoutput(
                "scp /root/Desktop/project/task0/jdk-8u171-linux-x64.rpm {}.{}.{}.{}:"
                .format(ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
            getoutput(
                "ssh {}.{}.{}.{} rpm -ivh jdk-8u171-linux-x64.rpm".format(
                    ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
            getoutput(
                "scp /root/Desktop/project/task0/.bashrc {}.{}.{}.{}:".format(
                    ip[i][0], ip[i][1], ip[i][2], ip[i][3]))
Ejemplo n.º 13
0
def send_hosts_to_all_ip():

    ip1 = all_ip.master_ip()
    ip2 = all_ip.jobtracker_ip()
    ip3 = all_ip.slaves_ip()
    ip4 = all_ip.slaves_ip()

    getoutput(
        "scp /root/Desktop/project/task0/hosts {}.{}.{}.{}:/etc/hosts".format(
            ip1[0], ip1[1], ip1[2], ip1[3]))

    getoutput(
        "scp /root/Desktop/project/task0/hosts {}.{}.{}.{}:/etc/hosts".format(
            ip2[0], ip2[1], ip2[2], ip2[3]))

    getoutput(
        "scp /root/Desktop/project/task0/hosts {}.{}.{}.{}:/etc/hosts".format(
            ip4[0], ip4[1], ip4[2], ip4[3]))

    for i in range(len(ip3)):
        getoutput(
            "scp /root/Desktop/project/task0/hosts {}.{}.{}.{}:/etc/hosts".
            format(ip3[i][0], ip3[i][1], ip3[i][2], ip3[i][3]))
Ejemplo n.º 14
0
def checktt():
	
	ip=all_ip.jobtracker_ip

	getoutput("ssh {}.{}.{}.{} hadoop job -list-active-trackers".format(ip[0],ip[1],ip[2],ip[3]))
Ejemplo n.º 15
0
def checkdn():

	ip=all_ip.master_ip
	getoutput("ssh {}.{}.{}.{} hadoop dfsadmin -report".format(ip[0],ip[1],ip[2],ip[3]))