[Gluster-devel] Fwd: How are port number for bricks incremented in gluster

Anuradha Talur atalur at redhat.com
Mon May 11 12:52:22 UTC 2015



----- Original Message -----
> From: "Bipin Kunal" <bkunal at redhat.com>
> To: gluster-devel at gluster.org
> Sent: Monday, May 11, 2015 5:23:55 PM
> Subject: [Gluster-devel] Fwd: How are port number for bricks incremented in	gluster
> 
> Hi All,
> 
> I have referred
> http://www.gluster.org/community/documentation/index.php/Basic_Gluster_Troubleshooting
> 
> 1. What ports does Gluster need?
> Preferably, your storage environment should be located on a safe segment of
> your network where firewall is not necessary. In the real world, that simply
> isn't possible for all environments. If you are willing to accept the
> potential performance loss of running a firewall, you need to know that
> Gluster makes use of the following ports:
> - 24007 TCP for the Gluster Daemon
> - 24008 TCP for Infiniband management (optional unless you are using IB)
> - One TCP port for each brick in a volume. So, for example, if you have 4
> bricks in a volume, port 24009 – 24012 would be used in GlusterFS 3.3 &
> below, 49152 - 49155 from GlusterFS 3.4 & later.
> - 38465, 38466 and 38467 TCP for the inline Gluster NFS server.
> - Additionally, port 111 TCP and UDP (since always) and port 2049 TCP-only
> (from GlusterFS 3.4 & later) are used for port mapper and should be open.
> Note: by default Gluster/NFS does not provide services over UDP, it is TCP
> only. You would need to enable the nfs.mount-udp option if you want to add
> UDP support for the MOUNT protocol. That's completely optional and is up to
> your judgement to use.
> 
> Here we say that a port will be associated with all the brick for a volume.
> 
> I would like to know how is this port number incremented ? Is it always
> sequential, meaning that if first brick will have port 49152 then will the
> second brick have port 49153 ?

The allocation is attempted to be sequential, it depends on the availability of
ports. If the 1st brick has port 49152, 2nd will have 49153
as long as the port 49153 is FREE i.e. not being used by anything else.

> Is their any such scenario where port number would not be sequential ?

Yes, there are scenarios where port numbers need not be sequential.

Port numbers are allocated by pmap_registry_alloc (). Following is a snippet :

.
.
.                                                                               
        for (p = pmap->last_alloc; p < 65535; p++) {                           
                if (pmap->ports[p].type != GF_PMAP_PORT_FREE)                  
                        continue;                                              
                                                                               
                if (pmap_port_isfree (p)) {                                    
                        pmap->ports[p].type = GF_PMAP_PORT_LEASED;             
                        port = p;                                              
                        break;                                                 
                }                                                              
        }                                                                      
                                                                               
        if (port)                                                              
                pmap->last_alloc = port; 
.
.
.

pmap->last_alloc denotes the last allocated port here. From the last allocated port,
till port 65535, it is incrementally checked if a port is free. If free, it is 
allocated.

> 
> Is their a way to give a range of ports for bricks?
> 
> Thanks,
> Bipin Kunal
> 
> 
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at gluster.org
> http://www.gluster.org/mailman/listinfo/gluster-devel
> 

-- 
Thanks,
Anuradha.


More information about the Gluster-devel mailing list