@@ -119,7 +119,7 @@ var sequelize = new Sequelize('database', 'username', 'password', {
...
@@ -119,7 +119,7 @@ var sequelize = new Sequelize('database', 'username', 'password', {
## Read replication
## Read replication
Sequelize supports read replication, i.e. having multiple servers that you can connect to when you want to do a SELECT query. When you do read replication, you specify one or more servers to act as read replicas, and one server to act as the write master, which handles all writes and updates and propagates them to the replicas (note that the actual replication process is**not **handled by Sequelize, but should be set up in MySql).
Sequelize supports read replication, i.e. having multiple servers that you can connect to when you want to do a SELECT query. When you do read replication, you specify one or more servers to act as read replicas, and one server to act as the write master, which handles all writes and updates and propagates them to the replicas (note that the actual replication process is**not**handled by Sequelize, but should be set up in MySql).
```js
```js
varsequelize=newSequelize('database',null,null,{
varsequelize=newSequelize('database',null,null,{
...
@@ -139,7 +139,7 @@ var sequelize = new Sequelize('database', null, null, {
...
@@ -139,7 +139,7 @@ var sequelize = new Sequelize('database', null, null, {
})
})
```
```
If you have any general settings that apply to all replicas you do not need to provide them for each instance. In the code above, database name and port is propagated to all replicas. The same will happen for user and password, if you leave them out for any of the replicas. Each replica has the following options:`host`,`port`,`username`,`password`,`database`
If you have any general settings that apply to all replicas you do not need to provide them for each instance. In the code above, database name and port is propagated to all replicas. The same will happen for user and password, if you leave them out for any of the replicas. Each replica has the following options:`host`,`port`,`username`,`password`,`database`.
Sequelize uses a pool to manage connections to your replicas. The default options are:
Sequelize uses a pool to manage connections to your replicas. The default options are:
...
@@ -157,11 +157,11 @@ If you want to modify these, you can pass pool as an options when instanti
...
@@ -157,11 +157,11 @@ If you want to modify these, you can pass pool as an options when instanti
## Dialects
## Dialects
With the release of Sequelize`v1.6.0`, the library got independent from specific dialects. This means, that you'll have to add the respective connector library to your project yourself. Version 1.7.0 stable has been released in bundles with the connector libraries (sequelize-mysql, sequelize-postgres etc.) but these bundles are not maintained, and will not be released for 2.0.0 upwards.
With the release of Sequelize`1.6.0`, the library got independent from specific dialects. This means, that you'll have to add the respective connector library to your project yourself. Version 1.7.0 stable has been released in bundles with the connector libraries (sequelize-mysql, sequelize-postgres etc.) but these bundles are not maintained, and will not be released for 2.0.0 upwards.
### MySQL
### MySQL
In order to get Sequelize working nicely together with MySQL, you'll need to install`mysql@~2.0.0-alpha7`or higher. Once that's done you can use it like this:
In order to get Sequelize working nicely together with MySQL, you'll need to install`mysql@~2.5.0`or higher. Once that's done you can use it like this:
As there are often use cases in which it is just easier to execute raw / already prepared SQL queries, you can utilize the function`sequelize.query`.
As there are often use cases in which it is just easier to execute raw / already prepared SQL queries, you can utilize the function`sequelize.query`.