.. meta:: :description: This documentation will guide you through the use of the Memset API. .. index:: double: Methods; cluster.service .. _cluster.service: Cluster Service Methods ----------------------- API methods for cluster services. .. function:: cluster.service.disable Disable the given Cluster Service. :param cluster_name: Name of the cluster. Cluster names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters. :type cluster_name: String :param service_name: Name of the cluster service. :type service_name: String :returns: If the service is enabled, a dictionary as described in :func:`job.status`. :raises: May raise :class:`ApiErrorDoesNotExist` if the cluster or Cluster Service does not exist. .. function:: cluster.service.enable Enable the given Cluster Service. :param cluster_name: Name of the cluster. Cluster names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters. :type cluster_name: String :param service_name: Name of the cluster service. :type service_name: String :returns: If the service is disabled, a dictionary as described in :func:`job.status`. :raises: May raise :class:`ApiErrorDoesNotExist` if the cluster or Cluster Service does not exist. .. function:: cluster.service.info Describe a cluster service :param cluster_name: Name of the cluster. Cluster names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters. :type cluster_name: String :param service_name: Name of the cluster service. :type service_name: String :returns: a dictionary with the following keys: **name** String: Name of the service. **enabled**: Boolean: If the service is enabled or not. **virtual_ip**: String: The load-balanced IP (that which should be used in DNS records). **port**: Integer: The TCP port number. **service**: String: Service type (e.g. http/ftp) **checktype**: String: Type of check to perform to determine membership of real servers in the cluster. On means no checking will take place and real servers will always be activated. **checktimeout**: Integer: Timeout in seconds for connect, external and ping checks. **checkport**: Integer: Number of port to monitor. Sometimes check port differs from service port. 0 is port specified for the real server. **request**: String: The request, e.g. 'test.html'. Only for negotiate checktypes. **receive**: String: The expected string e.g. 'Test'. Only for negotiate checktypes. **emailalert**: String: Email address for alert. An empty string means no alert. **scheduler**: String: Scheduler to be used for load balancing: rr - Robin Robin: distributes jobs equally amongst the available real servers. wrr - Weighted Round Robin: assigns jobs to real servers proportionally to the real servers' weight. Servers with higher weights receive new jobs first and get more jobs than servers with lower weights. Servers with equal weights get an equal distribution of new jobs. lc - Least-Connection: assigns more jobs to real servers with fewer active jobs. wlc - Weighted Least-Connection: assigns more jobs to servers with fewer jobs and relative to the real servers' weight (Ci/Wi). This is the default. lblc - Locality-Based Least-Connection: assigns jobs destined for the same IP address to the same server if the server is not overloaded and available; otherwise assign jobs to servers with fewer jobs, and keep it for future assignment. lblcr - Locality-Based Least-Connection with Replication: assigns jobs destined for the same IP address to the least-connection node in the server set for the IP address. If all the nodes in the server set are over loaded, it picks up a node with fewer jobs in the cluster and adds it in the sever set for the target. If the server set has not been modified for the specified time, the most loaded node is removed from the server set, in order to avoid high degree of replication. dh - Destination Hashing: assigns jobs to servers through looking up a statically assigned hash table by their destination IP addresses. sh - Source Hashing: assigns jobs to servers through looking up a statically assigned hash table by their source IP addresses. sed - Shortest Expected Delay: assigns an incoming job to the server with the shortest expected delay. The expected delay that the job will experience is (Ci + 1) / Ui if sent to the ith server, in which Ci is the number of jobs on the the ith server and Ui is the fixed service rate (weight) of the ith server. nq - Never Queue: assigns an incoming job to an idle server if there is one, instead of waiting for a fast one; if all the servers are busy, it adopts the Shortest Expected Delay policy to assign the job. **persistent**: Integer: Number of seconds for persistent client connections. **protocol**: String: Protocol to be used. **virtualhost**: String: Used when using a negotiate check with HTTP or HTTPS. Sets the host header used in the HTTP request. **forwarding_method**: String: Forwarding method for the director to reach the clustered servers. :raises: May raise :class:`ApiErrorDoesNotExist` if the cluster or Cluster Service does exist. .. function:: cluster.service.list List the services in a cluster. :param cluster_name: Name of the cluster. Cluster names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters. :type cluster_name: String :returns: a list of dictionaries where each is as described in :func:`cluster.service.info` :raises: May raise :class:`ApiErrorDoesNotExist` if the cluster does not exist. .. function:: cluster.service.status_image View cluster status as a graph, in PNG format. :param cluster_name: Name of the cluster. Cluster names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters. :type cluster_name: String :param service_name: Name of the cluster service. :type service_name: String :returns: a dictionary with the following keys: **data**: String: A string of binary PNG data.