# Kiwiplan - KDW Data Warehouse

## Introduction

The document assumes that you have the server build with a Kiwiplan environment.

These are things that need to be done on after the installation of KDW.

These instructions may not follow the same folder setup our was installed using the “KDW” site name.

### Environment

Add these to the environment to make it easier to navigate to the folders

```shell
export KIWIBASE=/KIWI
export KIWI=${KIWI:-/KIWI/site_$PLANTID}
export KBIN=${KBIN:-${KIWIBASE}/services/etl/kdw/current/kiwiplan/bin}
export KLOG=${KLOG:-${KIWIBASE}/services/etl/kdw/current/kiwiplan/log}
export KCONF=${KCONF:-${KIWIBASE}/services/etl/kdw/current/kiwiplan/conf}
```

Logout and log back in to get the variables and be able to use them

### Admin Console prep

You need to add the dashboard to the the pam authentication

```shell
cd $KCONF
sudo cp kdw-adminconsole_eample /etc/pam.d/kdw-adminconsole
```

### Database Readiness

Run this to make sure there are no table lock.

```mssql
USE master;
GO
ALTER DATABASE [kdw_master_datawarehouse]
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE [kdw_master_datawarehouse] SET READ_COMMITTED_SNAPSHOT ON;
GO
ALTER DATABASE [kdw_master_datawarehouse] 
SET MULTI_USER;
GOUSE master;
GO
ALTER DATABASE [kdw_working_datawarehouse]
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE [kdw_working_datawarehouse] SET READ_COMMITTED_SNAPSHOT ON;
GO
ALTER DATABASE [kdw_working_datawarehouse] 
SET MULTI_USER;
GO
```

### MySQL Connector

[https://dev.mysql.com/downloads/connector/j/](https://dev.mysql.com/downloads/connector/j/)

For 9.80.x revision you must use 5.41 as version 8.x.x do not work.

Extract the file and then copy the .jar to the DIST folder.

```shell
[/KIWI/services/etl/kdw/current/kiwiplan/dist]$
mysql-connector-java-5.1.44-bin.jar
```

### Setting Console

```shell
cd /opt/kiwi/services/etl/kdw/current/kiwiplan/conf
cp kdw-adminconsole_example /etc/pam.d/kdw-adminconsole
chmod 777 /etc/pam.d/kdw-adminconsole
```

### Extra Executors

To setup extra executors to reduce the time of execution for each system.

You will need to copy the executor properties files to another by adding a numeric value to the name

```shell
[/KIWI/services/etl/kdw/current/kiwiplan/conf]$ 
cp application_executor.properties application_executor1.properties
```

The new file needs to be edited and this value changed

```shell
## KDW executer name
kdw.executor-name=Main_Executor
```

To the following value

```shell
kdw.executor-name=Main_Executor1
```

### Revision 9.8.x

Make sure you un the following.

```shell
[/KIWI/services/etl/kdw/current/kiwiplan/bin]$
dwdate_initialization.sh
```

### Restart Script

You can create a restart.sh script with the following

```shell
[/KIWI/services/etl/kdw/current/kiwiplan/bin]$ 
vi restart.sh
```

Then add this in the file

```shell
:
./stopExecutors.sh
./stopSchedulers.sh
./startSchedulers.sh
sleep 15
./startExecutors.sh
```

Make the file executable for the system

```shell
[/KIWI/services/etl/kdw/current/kiwiplan/bin]$
chmod 777 restart.sh
```