# loopback-connector-readsplitmysql

> Read Split MySQL connector for loopback-datasource-juggler

Latest version **2.4.1** (published 2017-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install loopback-connector-readsplitmysql
pnpm add loopback-connector-readsplitmysql
yarn add loopback-connector-readsplitmysql
bun add loopback-connector-readsplitmysql
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.4.1 |
| Published | 2017-02-06 |
| First published | 2017-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | jdswift |

## Links

- npm: https://www.npmjs.com/package/loopback-connector-readsplitmysql
- Repository: https://github.com/jswift/loopback-connector-readsplitmysql
- Homepage: https://github.com/jswift/loopback-connector-readsplitmysql#readme
- Issues: https://github.com/jswift/loopback-connector-readsplitmysql/issues
- npm.io page: https://npm.io/package/loopback-connector-readsplitmysql

## Dependencies (5)

- [async](https://npm.io/package/async.md) ^0.9.0
- [debug](https://npm.io/package/debug.md) ^2.1.1
- [mysql](https://npm.io/package/mysql.md) ^2.11.1
- [strong-globalize](https://npm.io/package/strong-globalize.md) ^2.5.8
- [loopback-connector](https://npm.io/package/loopback-connector.md) ^2.4.0

## Recent versions

- 2.4.1 (latest) — 2017-02-06
- 2.4.4 (lts) — 2017-02-12
- 2.4.3 — 2017-02-10
- 2.4.2 — 2017-02-06

## README

# loopback-connector-readsplitmysql
This is an entirely compatible fork of the mysql connector module that adds read/write splitting.
`loopback-connector-mysql` is the MySQL connector module for [loopback-datasource-juggler](https://github.com/strongloop/loopback-datasource-juggler/).

For complete documentation of the mysql connector, see [StrongLoop Documentation | MySQL Connector](http://loopback.io/doc/en/lb2/MySQL-connector.html).

Read/Write splitting allows loopback to take advantage of Read-Replicas by directing all read-only queries
to faster read replica slaves, whilst writes are sent to the master database.

## Installation

````sh
npm install loopback-connector-readsplitmysql --save
````

## Basic use
The read split connector can be used in-place of the latest 2x mysql connector. With no additional
configuration it will continue to operate against one master database.

To add a read-replica host, add a `readonly` object to the settings object. All fields are optional.
The database connection options will default to the same as the master connection. To disable the read
client, either don't set the `readonly` options at all or set the `writeRatio` to 1.

| Option                | Default    | Description                                                      |
| --------------------- | ---------- | ---------------------------------------------------------------- |
| `readonly.writeRatio` | 0.3        | The fraction of connectionLimit to dedicate to write connections |
| `readonly.host`       | `host`     | The host for read-only queries                                   |
| `readonly.port`       | `port`     | The port for read-only queries                                   |
| `readonly.user`       | `user`     | The user for read-only queries                                   |
| `readonly.password`   | `password` | The password for read-only queries                               |

---
_Source: https://npm.io/package/loopback-connector-readsplitmysql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
