Beispiel #1
0
import os
import sys
sys.path.append('./lib/')
import time
import signal
import logging

from clusterdfs.datanode import DataNodeConfig, DataNode, DataNodeClient

config = DataNodeConfig.from_dict({
    'datadir': '/tmp/',
    'isolated': True,
    'port': 4426
})

print 'generating file...'
os.system(
    "dd if=/dev/urandom of=/tmp/_test_random_file_64MB_a bs=5000000 count=1 &> /dev/null"
)

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

pid = os.fork()
if pid == 0:
    h = logging.FileHandler('/tmp/datanode.log')
    h.setFormatter(logging.Formatter("%(levelname)s: %(name)s - %(message)s"))
    logger.addHandler(h)

    datanode = DataNode(config)
    try:
import signal
import logging
        
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
        
n = 16

children = []
for i in xrange(n):
    child = os.fork()
    if child:
        children.append(child)
    else:
        from clusterdfs.datanode import DataNodeConfig, DataNode, DataNodeClient
        config = DataNodeConfig.from_dict({'datadir':'/home/ubuntu/data/','isolated':True, 'port':3900})        

        
        h = logging.FileHandler('/tmp/datanode%i.log'%i) 
        h.setFormatter(logging.Formatter("datanode%02d %%(created)f %%(levelname)s: %%(name)s - %%(message)s"%i))
        logger.addHandler(h)

        config.port += i
        datanode = DataNode(config)
        try:
            datanode.init()
            datanode.finalize()
        except KeyboardInterrupt:
            print 'finalizing.....'
            datanode.finalize()
        finally:
import os
import sys

sys.path.append("./lib/")
import time
import signal
import logging

from clusterdfs.datanode import DataNodeConfig, DataNode, DataNodeClient

config = DataNodeConfig.from_dict({"datadir": "/tmp/", "isolated": True, "port": 4426})

print "generating file..."
os.system("dd if=/dev/urandom of=/tmp/_test_random_file bs=5000000 count=1 &> /dev/null")

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

pid = os.fork()
if pid == 0:
    h = logging.FileHandler("/tmp/datanode.log")
    h.setFormatter(logging.Formatter("%(levelname)s: %(name)s - %(message)s"))
    logger.addHandler(h)

    datanode = DataNode(config)
    try:
        datanode.init()
        datanode.finalize()
    except KeyboardInterrupt:
        print "finalizing....."
        datanode.finalize()
Beispiel #4
0
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

n = 16

children = []
for i in xrange(n):
    child = os.fork()
    if child:
        children.append(child)
    else:
        from clusterdfs.datanode import DataNodeConfig, DataNode, DataNodeClient
        config = DataNodeConfig.from_dict({
            'datadir': '/home/ubuntu/data/',
            'isolated': True,
            'port': 3900
        })

        h = logging.FileHandler('/tmp/datanode%i.log' % i)
        h.setFormatter(
            logging.Formatter(
                "datanode%02d %%(created)f %%(levelname)s: %%(name)s - %%(message)s"
                % i))
        logger.addHandler(h)

        config.port += i
        datanode = DataNode(config)
        try:
            datanode.init()
            datanode.finalize()
Beispiel #5
0
import os
import sys
sys.path.append('./lib/')
import time
import signal
import logging

from clusterdfs.datanode import DataNodeConfig, DataNode, DataNodeClient

config = DataNodeConfig.from_dict({'datadir':'/tmp/','isolated':True, 'port':4426})

print 'generating file...'
os.system("dd if=/dev/urandom of=/tmp/_test_random_file_64MB_a bs=5000000 count=1 &> /dev/null")

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
    
pid = os.fork() 
if pid==0:
    h = logging.FileHandler('/tmp/datanode.log') 
    h.setFormatter(logging.Formatter("%(levelname)s: %(name)s - %(message)s"))
    logger.addHandler(h)
        
    datanode = DataNode(config)
    try:
        datanode.init()
        datanode.finalize()
    except KeyboardInterrupt:
        print 'finalizing.....'
        datanode.finalize()
else: