<!-- Source: https://docs.squirro.com/en/latest/technical/admin/operations/accessing-servers.html -->
# Accessing Servers

This page details how to access the Squirro Server, Squirro Application, Redis Server, and MariaDB Server.

> **Warning**
>
> Squirro cannot provide support for issues that arise as a consequence of updating data directly in MariaDB or Redis.

## Default Logins

### MariaDB User

The root user is typically configured for passwordless login to MariaDB.

This is done with the `/root/.my.cnf` configuration file, specifically using the password option in the client section.

Tip: If you change the root password, it is recommended you also update this configuration file.

An example file looks like this:

```ini
[client]
password=MyRootPasswordExample!
```

### Redis Password

The passwords for Redis instances are defined in the two configuration files using the `masterauth` directive and can be looked up there.

The two configuration files are `/etc/redis/redis.conf` and `/etc/redis/cache.conf`.

The relevant part of the configuration file will look like this:

```ini
# If the master is password protected (using the "requirepass" configuration
# directive below) it is possible to tell the replica to authenticate before
# starting the replication synchronization process, otherwise the master will
# refuse the replica request.
#
masterauth MyRedisPassword!
```

## Accessing the Squirro Server

### Login

For administrative access, you can connect to the server using SSH. Mac and Linux come with a built-in SSH client, on Windows Squirro recommends [PuTTy](http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download.html).

If you do not know the IP address of the server, see [Finding the IP Address](#admin-access-ip) on this page.

### Root Access

Once logged in you can gain root access using `sudo` by typing this command:

```shell-session
$ sudo -s
```

Sudo will ask you for your password again.

### Which version of Squirro

```python
cat /etc/squirro/version.ini
```

## Accessing Squirro Application

### Introduction

With the Squirro cluster running you can access the Squirro app via:

`https://<ip-address>`

### Creating a Squirro user

By default there is no user set up for the Squirro web interface. To create a new admin user proceed as follows:

1. Visit `https://<ip-address>` (see below if you don’t know the IP address)
2. Click the Signup Button:
   [![image1](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/13598775/13598779.png)](https://s3.amazonaws.com/download.squirro.net/docs/migrated-attachments/13598775/13598779.png)
3. Create a a user with a valid email address and a secure password. This will become the admin user.
4. To prevent further user from being created this way, you can disable the signup option as documented in [Configuration](../configuration/index.md#admin-config).

### Finding the IP Address

If you do not know the IP address of the machine, there are several ways to find it.

After booting the IP address is displayed in the console on the login screen. It might take a while for this address to update after booting.

Alternatively, you can also log into the machine using a username and password. Reference the next section for information.

Once you have a session on the server, type the following command:

```python
ifconfig eth0
```

This will output the machine’s IP address.

## Accessing Redis Server

Redis is used by Squirro for caching, queuing and some ephemeral data. See [Flushing Caches](../troubleshooting/flush-cache.md#admin-flush-cache) for more information.

> **Warning**
>
> Squirro cannot provide support for issues that arise as a consequence of updating data directly in Redis.

### Login

Default firewall settings do not allow for direct Redis connections from the outside. To gain administrative Redis access, you have to connect to the server using SSH first.

### Access

Once logged in you can access Redis using the `redis-cli` command line tool. There are two ways of providing the Redis password - directly on the command line, or using the AUTH command.

### Command Line Login

Start the redis-cli application by specifying the password using the `-a` option.

```text
[squirro@localhost ~]$ redis-cli -a REDIS_PASSWORD
127.0.0.1:6379>
```

### AUTH Login

Start the redis-cli application, then specify the password in the Redis command line:

```text
[squirro@localhost ~]$ redis-cli
127.0.0.1:6379> auth REDIS_PASSWORD
OK
127.0.0.1:6379>
```

### Instances

A standard Squirro installation comes with two instances of Redis: `redis-server` and `redis-server-cache`. `redis-server` runs on the standard Redis port 6379 and is used for storage and queueing. `redis-server-cache` runs on the port 6380 and is used for caching. To connect to the `redis-server-cache` instance add the `-p` parameter to `redis-cli` with a value of `6380`. E.g.:

```text
[squirro@localhost ~]$ redis-cli -p 6380 -a REDIS_PASSWORD
127.0.0.1:6380>
```

### Databases

Squirro uses different Redis databases. To see the used databases and their usage, use the `info` command:

```text
127.0.0.1:6379> info
…
# Keyspace
db0:keys=3,expires=0,avg_ttl=0
db7:keys=82,expires=66,avg_ttl=10570724
db9:keys=114,expires=88,avg_ttl=89586306
db10:keys=2,expires=0,avg_ttl=0127.0.0.1:6379>
```

The default database is `db0`. To switch to a different database for subsequent commands, use the select command:

```text
127.0.0.1:6379> select 7
OK
127.0.0.1:6379[7]>
```

The prompt of the Redis tool now shows the selected database.

Here is an overview of all Redis databases that are in use:

|  |  |  |  |
| --- | --- | --- | --- |
| DB Number | Used for | Use Case | Redis-Server Instance |
| 0 | 1. ContentDb temporarily “queued” items before pipeline can get to them 2. Task Queue (Kombu) in various services | Storage and Queuing | `redis-server` (port 6379) |
| 6 | Key-value store for the dataloader plugins (Used by the dataloader provider) | Storage | `redis-server` (port 6379) |
| 6 | Key-value cache for the dataloader plugins (Used by the dataloader provider) | Caching | `redis-server-cache` (port 6380) |
| 7 | Query cache (used by the Topic API) | Caching | `redis-server-cache` (port 6380) |
| 8 | Filtering service sent email items | Storage | `redis-server` (port 6379) |
| 9 | HTTP request cache | Caching | `redis-server-cache` (port 6380) |
| 12 | Squirro Studio Storage | Storage | `redis-server` (port 6379) |
| 12 | Squirro Studio Cache | Cache | `redis-server-cache` (port 6380) |
| 15 | Applications should add their data in databases 15 or use a dedicated process/Redis-Cloud instance |  |  |

## Accessing MariaDB Server

MariaDB is used by Squirro for metadata storage (see [Services](services.md#admin-services) for more information). To investigate this metadata, MariaDB can be accessed directly.

> **Warning**
>
> Squirro cannot provide support for issues that arise as a consequence of updating data directly in MariaDB.

### Login

Default firewall settings do not allow for direct MariaDB connections from the outside. To gain administrative MariaDB access, you have to connect to the server using SSH first.

### Root Access

Once logged in you can gain MariaDB root access using `mysql` by typing this command:

```text
[squirro@localhost ~]$ mysql -u root -p
```

You will be asked you for the MariaDB root password.
