コード例 #1
0
def main():
    """
    bootstrap function
    """
    params = sys.argv[1:]
    parser = argparse.ArgumentParser(description='A log consumer')
    parser.add_argument('-z',
                        '--zkServer',
                        help='address of the zookeeper server',
                        default="fd88:9fde:bd6e:f57a:0:1d7b:9dea:802:29017",
                        required=True)
    parser.add_argument('-n',
                        '--normalizer',
                        help=' path to pylogs parser normalizers',
                        default="/home/lahoucine/src/pylogsparser/normalizers",
                        required=True)

    args = parser.parse_args(params)

    zkAddr = args.zkServer
    normalizer = args.normalizer
    try:
        zc = RetryClient(ZookeeperClient(zkAddr))
        d = zc.connect()
        d.addCallback(cb_connected, zc, normalizer)
        d.addErrback(log.msg)
    except:
        print "Can't connect to Zookeeper"
        return

    reactor.run()
コード例 #2
0
def main():
    """
    bootstrap function
    """
    params = sys.argv[1:]
    parser = argparse.ArgumentParser(description='Log producer with embedded https server ')
    parser.add_argument('-z','--zkServer',help='address of the zookeeper server', 
                                          default="localhost:2181", required=True)
    parser.add_argument('-a','--host',help='the hostname/ip to bind to, defaults to localhost', 
                                          default="localhost", required = False)
    parser.add_argument('-p','--port',help='the port to listen in', type=int, 
                                          default="8991", required=False)
    parser.add_argument('-c','--certDir',help='the directory to store https  certificat and key', 
                                          default="/tmp/", required=False)
    
    args = parser.parse_args(params)
    zkAddr = args.zkServer
    host = args.host
    port = args.port
    certDir = args.certDir
    try:
        zc = RetryClient(ZookeeperClient(zkAddr))
        d = zc.connect()
        d.addCallback(cb_connected, zc, host, port, certDir)
        d.addErrback(log.msg)
    except:
        print "Can't connect to Zookeeper!"
        return
        
    reactor.run()
コード例 #3
0
    def __init__(self, config):
        # zoopy is really friggin' loud without this
        zookeeper.set_debug_level(0)

        connection_string = config["hostsource"]["connection-string"]
        self.client = ZookeeperClient(connection_string, session_timeout=3000)
        self.user = config["hostsource"]["user"]
        self.password = config["hostsource"]["password"]
コード例 #4
0
def main():
    """
    the aim of this code is to start an instance of solr, and publishing
    its configuration (address + port) into the configuration tree managed
    by Zookeeper.
    the znode created for this configuration must be a Ephemeral.
    with that type of znode, the configuration added exist only if the client
    is up.
    """
    params = sys.argv[1:]

    parser = argparse.ArgumentParser(description='Solr bootstrap')
    parser.add_argument('-z',
                        '--zkaddr',
                        help='zookeeper address',
                        required=True)
    parser.add_argument('-c', '--cores', help='cores path',
                        required=False)  #TO DO a remplacer par conf
    parser.add_argument('-m', '--solrhome', help='solr home',
                        required=True)  #TO DO a remplacer par conf
    parser.add_argument('-s', '--solrpath', help='solr path', required=True)
    parser.add_argument('-p', '--port', help='listening port', required=True)
    parser.add_argument('-i', '--ip', help='listening ip', required=True)
    parser.add_argument('-j', '--java', help='java home', required=True)
    parser.add_argument('-n',
                        '--numshard',
                        help='number shard',
                        required=False)

    args = parser.parse_args(params)

    zk = args.zkaddr
    cores = args.cores
    solrpath = args.solrpath
    solrhome = args.solrhome
    port = args.port
    ip = args.ip
    java = args.java
    numsh = args.numshard
    try:
        zc = RetryClient(ZookeeperClient(zk))
        d = zc.connect()
        d.addCallback(cb_connected, zc, cores, solrpath, solrhome, numsh, port,
                      ip, java, zk)
        d.addErrback(log.msg)
    except:
        print "Can't connect to Zokeeper!"
        return
    reactor.run()