User Guide

Webscale CLI Reference Guide

The webscale-cli command is the Swiss army knife of Webscale commands. It can be used to fix permissions, restart servers, check the health of the cluster, and many other things. The normal form for using webscale-cli is:

sudo webscale-cli some-command

Some of the most common uses of this command are to check server health, gather information about clusters, or fix permissions on the filesystem. The command must always be preceded with the command sudo or it will fail.

Cluster Health

One of the most common uses is to check the overall health of the cluster. This command will show things like mysql queries, recent file changes and other details about the cluster and the database.

The command line for this is sudo webscale-cli health

webscale-cli-health

If you are interested in only parts of the health command output, there are options for that as well.

sudo webscale-cli health –changes

This only searches the local filesystem under /var/www not following symbolic links.

webscale-cli-deep

sudo webscale-cli health –changes –deep

This searches /var/www and /var/www/shared following symbolic links. It will usually take much longer to return data.

sudo webscale-cli health –changes /some/path

Specify the directory that you would like to see the most recently changed files in.

webscale-cli-paath

sudo webscale-cli health –db  

This form of the command will show the top db queries, sorted from longest to shortest living.

webscale-cli-db

It is probable that this command will return no data when the database is not heavily loaded.

sudo webscale-cli health –users

Show the users currently logged in, and what commands they are running.

webscale-cli-users

sudo webscale-cli health –load-avg

Show the last 2 minutes load average

webscale-cli-avg

sudo webscale-cli health –acs

Show the results from acs-status. e.g. is lsyncd currently syncing to the cluster?

Information Gathering

sudo webscale-cli apps servers

This will return the internal ip address of servers for the applications as defined in the config file, /etc/lagrange-credentials.yml

webscale-cli-servers

clusters:  Your Webscale application clusters

To see the output of the clusters command, you will need to expand your terminal window to 173 columns.

webscale-cli-cluster

–cluster-name: Prints the cluster name for each application.

webscale-cli-cluster-name

–cluster-id   : Prints the cluster id for each application.

webscale-cli-cluster-id

private-ips  : Return only the private ip addresses

webscale-cli-private-ips

–public-ips   : Return only the public ips

webscale-cli-public-ips

–ips          : Return only the private ip addresses

webscale-cli-ips

Restarting

Is it possible to use the webscale-cli command to restart application servers on all of the application server.

sudo webscale-cli restart <service>
    apache2, php5-fpm, php5.6-fpm, php7.0-fpm, lsyncd, sessions, magento, fpc, apache, php, sync

Apache, apache2 and the php restarts are for the http server, and the php fpm servers. You should know which version of php and apache you need to restart.

Security

sudo webscale-cli security – This is the security subset of tools, which only includes log capture at this time.
–log-capture  : Ssh to every app server and tar /var/log/apache2/

sudo webscale-cli security –log-capture

webscale-cli-log-capture

Deploying

There are two deploy subcommands. One that fixes permissions on the local dataserver, and one that fixes issues on application servers that may prevent automatic syncing.

This form of the webscale-cli command will recurse through the /var/www/web_root and the /var/www/shared/ directories to make sure that all the files underneath these two directories are set to the proper ownership and permissions. It is normally run after any deployment to make sure things are as they should be.

This command accepts a path if you want set permissions on a certain subset of files.

If you have files or directories that need to be excluded from this command, list them in the file /home/www-upload/skip_files with one file or directory per line. You may also use unix filesystem regular expressions.

sudo webscale-cli deploy permissions

webscale-cli-permissions

sudo webscale-cli deploy app_permissions

This does the same thing, but on the application/web servers that exist when the command is executed.

webscale-cli-app-permissions