> For the complete documentation index, see [llms.txt](https://docs.livestreamiq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.livestreamiq.com/readme-1/2.-installation/2.2-guide-for-virtual-machine-vm-installation/2.2.1-for-windows.md).

# 2.2.1 For Windows

This section outlines the prerequisites and installation procedure for deploying LivestreamIQ on a Windows operating system.

### **1. Pre-Requisite:**

Before proceeding with the installation, ensure the following requirements are met:

* Windows Server (for windows 11,10)
* Java 17
* LivestreamIQ application JAR file (example -livestreamiq-4.1.2.jar)
* Postresql with timecase db
* PgAdmin for DB monitoring

#### 2. Installation Steps:

The installation process is divided into the following two parts:

1. [Setup of TimeScaleDB](#id-1.-setup-of-timescaledb)
2. [Setup of LiveStreamIQ Platform](#id-2.-setup-of-livestreamiq-platform)
3. [Ideal System Configuration](#id-3.-ideal-system-configuration)

### **1. Setup of TimeScaleDB**

**Step 1 -Install PostgreSQL**

1. Download the PostgreSQL Windows installer from the official EnterpriseDB site: [PostgreSQL](https://www.postgresql.org/download/windows/)
2. Run the installer as Administrator.
3. Select components: PostgreSQL Server, pgAdmin 4, Command Line Tools, Stack Builder.
4. Choose an installation directory (default: *C:\Program Files\PostgreSQL\16*).
5. Set a strong password for the postgres superuser — record it securely (e.g., in a password manager).
6. Set the port (default *5432*). Keep default unless it conflicts with another service.
7. Select default locale and complete the installation.

{% hint style="info" %}
**Note:** Use a strong, unique password for the postgres user in production. Avoid default or weak passwords.
{% endhint %}

**Step 2 -Install the TimescaleDB Extension**

**Using the TimescaleDB Windows Installer:**

1. Download the TimescaleDB installer for Windows from [Link](https://www.tigerdata.com/docs/get-started/choose-your-path/install-timescaledb).
2. Run the installer as Administrator. It auto-detects your PostgreSQL installation.
3. Select the PostgreSQL instance (version and data directory) to attach TimescaleDB.
4. Allow the installer to update postgresql.conf and add the shared\_preload\_libraries entry automatically.
5. Restart the PostgreSQL service when prompted.
   1. **To Verify postgresql.conf:**\
      Confirm the configuration file (typically at C:\ProgramFiles\PostgreSQL\16\data\postgresql.conf) contains:<br>

      ```
      shared_preload_libraries = 'timescaledb'
      ```
   2. **To Restart PostgreSQL Service:**\
      Use Windows Services (services.msc) or the command line:

      ```
      net start postgresql-x64-16
      net stop postgresql-x64-16 
      ```
   3. Enable the Extension in Your Database:
      1. Connect via psql or pgAdmin Query Tool and run:<br>

         ```
         CREATE EXTENSION IF NOT EXISTS timescaledb;
         ```
      2. Verify installation:<br>

         ```
         SELECT extname, extversion FROM pg_extension WHERE extname = 'timescaledb';
         ```

**Step 3 - Production Configuration (postgresql.conf)**

Tune the following parameters based on available server resources. Use the TimescaleDB tuning tool to generate recommended values:

```
timescaledb-tune --quiet --yes
```

**Step 4 - Create a Hypertable**

TimescaleDB's core feature is the hypertable, which automatically partitions time-series data.

```
CREATE TABLE IF NOT EXISTS kafka_metrics (
    time TIMESTAMPTZ NOT NULL,
    cluster_name VARCHAR(64) NOT NULL,
    broker_id INT,
    metric_name TEXT NOT NULL,
    metric_label TEXT,
    object_name TEXT,
    metric_value DOUBLE PRECISION NOT NULL
);

SELECT create_hypertable(
    'kafka_metrics',
    'time'
);
```

{% hint style="info" %}
**Note:** For production, avoid listen\_addresses = '\*' combined with open firewall rules. Restrict\
access using Windows Firewall rules and pg\_hba.conf entries scoped to known IP ranges, and\
always use encrypted/strong authentication, never 'trust'.
{% endhint %}

**Step 5 - Windows Firewall Configuration**

1. Open Windows Defender Firewall with Advanced Security.
2. Create a new Inbound Rule → Port → TCP → 5432. 15.
3. Restrict the rule's scope to trusted IP addresses (application servers, admin workstations).
4. Name the rule (e.g., "PostgreSQL TimescaleDB") and enable it.

**Step 6 - Backup and Maintenance**

1. Logical Backups<br>

   ```
   pg_dump -U postgres -Fc -f "C:\Backups\timescale_backup.dump" your_database
   ```
2. Restore<br>

   ```
   pg_restore -U postgres -d your_database "C:\Backups\timescale_backup.dump"
   ```
3. Continuous Aggregates and Retention (TimescaleDB-specific)
   1. Use continuous aggregates to pre-compute rollups for faster dashboards.
   2. Use add\_retention\_policy() to automatically drop old chunks beyond a defined age.
   3. Use add\_compression\_policy() to compress older chunks and reduce storage.<br>

      ```
      SELECT add_retention_policy('sensor_data', INTERVAL '90 days'); 
      ALTER TABLE sensor_data SET (timescaledb.compress); 
      SELECT add_compression_policy('sensor_data', INTERVAL '7 days'); 
      ```

*Use Windows Task Scheduler to run a batch script with pg\_dump on a daily/weekly schedule, storing backups on a separate disk or network share.*

{% hint style="info" %}
**Note:**

• PostgreSQL Windows installer: <https://www.postgresql.org/download/windows/\\>
• TimescaleDB Windows install docs: <https://docs.timescale.com/self-\\>
hosted/latest/install/installation-windows/\
• pgAdmin downloads: <https://www.pgadmin.org/download/pgadmin-4-windows/>
{% endhint %}

### **2. Setup of LiveStreamIQ Platform**

Step 1 - Download and install NSSM

1. Get it from [download](https://nssm.cc/download).
2. Extract it somewhere permanent, e.g. C:\nssm\nssm.exe
3. Add that folder to your PATH (optional, but handy)

Step 2 - Install the service

1. Open an elevated (Administrator) Command Prompt or PowerShell:<br>

   ```
   nssm install lvs
   ```

   <figure><img src="https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-c5fe998f0b474ac6f14931cdeffd2b78089207af%2Fimage%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

Step 3 - Set the application path

1. If the user is running, say, a Python script, a Node app, or a compiled .exe — the "Application" is the actual executable, and your script/file is an argument.\
   **GUI:** Application tab → Path<br>

   <figure><img src="https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-d4e5d83706614faf5d87f9272b3384bb4902d848%2Fimage%20(2).png?alt=media" alt=""><figcaption></figcaption></figure>

   ```
   nssm set lvs Application "C:\Program Files\java\jdk-17\java.exe"
   ```

Step 4 - Set arguments

**GUI:** Application tab → Arguments

```
nssm set lvs AppParameters "-jar C:\livestreamiq\livestreamiq-4.1.1.jar --port 8080"
```

Step 5 - Set the "Startup directory" (working dir)

```
nssm set lvs AppDirectory "C:\livestreamiq"
```

Step 6 - Set environment variables

**GUI:** Environment tab

<figure><img src="https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-ee66e855c19b62c1c66049db037b1cfc2bbf1ed3%2Fimage%20(10).png?alt=media" alt=""><figcaption></figcaption></figure>

```
nssm set lvs AppEnvironmentExtra ^
"SPRING_PROFILES_ACTIVE=prod" ^
"LVS_DB_URL=r2dbc:postgresql://192.168.96.24:5432/lvs" ^
"LVS_DB_USERNAME=postgres" ^
"LVS_DB_PASSWORD=postgres" ^
"ALLOW_ORIGIN=www.livestreamiq.com"
```

Step 7 - Set up logging (stdout/stderr redirection)

**GUI** - I/O tab

<figure><img src="https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-c5ceaedcdceef9cfc75eb86404e13bff1848ae9b%2Fimage%20(11).png?alt=media" alt=""><figcaption></figcaption></figure>

```
nssm set lvs AppStdout "C:\livestreamiq\logs\stdout.log"
nssm set lvs AppStderr "C:\livestreamiq\logs\stderr.log"
```

1. Make sure the logs folder exists first:<br>

   ```
   mkdir C:\livestreamiq\logs
   ```
2. Enable log rotation (so logs don't grow forever):<br>

   ```
   nssm set lvs AppRotateFiles 1
   nssm set lvs AppRotateOnline 1
   nssm set lvs AppRotateSeconds 86400
   nssm set lvs AppRotateBytes 10485760
   ```

Step 8 - Start the service

```
nssm start lvs
```

Step 9 - Check status / logs

```
nssm status lvs
```

Then check:

```
type C:\livestreamiq\logs\stdout.log
type C:\livestreamiq\logs\stderr.log
```

Step 9 - Edit the service

```
nssm edit lvs
```

1. Open the GUI tab you can edit all parameter of the service.<br>

   <figure><img src="https://1499573743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6jSyTKzD9UG0uYLYFS7I%2Fuploads%2Fgit-blob-a1b566538677b28d4628daf563a8ebbe1df17423%2Fimage%20(12).png?alt=media" alt=""><figcaption></figcaption></figure>

### **3. Ideal System Configuration**

The following configuration is recommended for a production environment.

<table data-search="false"><thead><tr><th>Parameter</th><th>Purpose</th><th>Typical Production Guidance</th></tr></thead><tbody><tr><td>shared_buffers</td><td>Memory for caching data</td><td>~25% of total RAM</td></tr><tr><td>effective_cache_size</td><td>Planner hint for OS cache</td><td>~50–75% of total RAM</td></tr><tr><td>work_mem</td><td>Memory per sort/hash operation</td><td>Tune per workload, e.g. 16–64 MB</td></tr><tr><td>maintenance_work_mem</td><td>Memory for maintenance tasks</td><td>256 MB – 2 GB</td></tr><tr><td>max_connections</td><td>Concurrent connections allowed</td><td>Set per app/connection pooler needs</td></tr><tr><td>wal_level</td><td>Write-ahead log detail</td><td>replica (for backups/replication)</td></tr><tr><td>max_wal_size</td><td>WAL size before checkpoint</td><td>1–4 GB depending on write volume</td></tr><tr><td>random_page_cost</td><td>Planner cost for random I/O</td><td>1.1 for SSD storage</td></tr></tbody></table>

{% hint style="info" %}
*Note: Restart the PostgreSQL Windows service after changing postgresql.conf for the changes to take effect.*
{% endhint %}

*After you apply these settings, restart PostgreSQL and the `lvs` service, then confirm that **LivestreamIQ** starts cleanly and connects to TimescaleDB without authentication, network, or schema errors.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.livestreamiq.com/readme-1/2.-installation/2.2-guide-for-virtual-machine-vm-installation/2.2.1-for-windows.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
