bottlerocket
所属分类:后台框架
开发工具:kotlin
文件大小:75KB
下载次数:0
上传日期:2023-06-08 18:00:15
上 传 者:
sh-1993
说明: 一个Kotlin API,用于以编程方式创建MongoDB集群,主要用于测试基于MongoDB的应用程序和...
(A Kotlin API for programmatically creating MongoDB clusters primarily for use in testing MongoDB based applications and libraries.)
文件列表:
LICENSE (11558, 2023-08-17)
config (0, 2023-08-17)
config\eclipse-format.xml (36703, 2023-08-17)
config\eclipse.importorder (75, 2023-08-17)
config\findbugs-exclude.xml (2482, 2023-08-17)
pom.xml (8213, 2023-08-17)
src (0, 2023-08-17)
src\main (0, 2023-08-17)
src\main\kotlin (0, 2023-08-17)
src\main\kotlin\com (0, 2023-08-17)
src\main\kotlin\com\antwerkz (0, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket (0, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\BottleRocket.kt (974, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\BottleRocketTest.kt (2552, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\DatabaseRole.kt (288, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\LinuxDistribution.kt (2074, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\MongoDistribution.kt (6733, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\MongoManager.kt (3485, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\Versions.kt (777, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\clusters (0, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\clusters\ClusterBuilder.kt (1396, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\clusters\Configurable.kt (344, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\clusters\MongoCluster.kt (7770, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\clusters\PemFile.kt (553, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\clusters\PortAllocator.kt (254, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\clusters\ReplicaSet.kt (5892, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\clusters\ShardedCluster.kt (4394, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\clusters\SingleNode.kt (1722, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\configuration (0, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\configuration\Added.kt (161, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\configuration\ConfigBlock.kt (2884, 2023-08-17)
src\main\kotlin\com\antwerkz\bottlerocket\configuration\ConfigMode.kt (107, 2023-08-17)
... ...
This project has been deprecated in favor of [testcontainers](http://testcontainers.org). I'm keeping it around to test various CI/release changes I want to make for my other projects. Any new releases should be ignored.
---
# DISCONTINUED
This project has been deprecated
# BottleRocket
BottleRocket is an API to create MongoDB clusters in a variety shapes. It's intended for use in various testing scenarios where you need
to test your application or library against various configurations of clusters. BottleRocket is written in [Kotlin](http://kotlinlang.org/) but can be used by any Java project. In fact, even though the core is written in Kotlin, the tests are written in Java to help
ensure the API stays friendly to Java developers while still taking advantage of the language features Kotlin offers.
## Installing BottleRocket
### Maven
```xml
com.antwerkz.bottlerocket
bottlerocket
${version}
```
### Gradle
```groovy
compile 'com.antwerkz.bottlerocket:bottlerocket:${version}`
```
## Using BottleRocket
There are complete examples in the [tests](blob/master/src/test/java/com/antwerkz/bottlerocket/MongoClusterTest.java#L18-18) but using
BottleRocket is fairly straightforward. There are three types of clusters you can make: single node, replica sets, and sharded.
### Single Node
The simplest case is the single node cluster. While it is not recommended for production use, it's the most common case when testing.
There are builders available for each of the three cluster types. For a single node cluster, you would `SingleNode`'s builder:
```java
SingleNode mongod = SingleNode.builder().build();
```
This will create a single `mongod` instance running on port 30000. `SingleNode` is an instance of `MongoCluster` which provides methods
to start and shutdown the node as well as a `clean()` which will remove everything from the `SingleNode`'s base directory on down. It is
possible to configure the port and the directory where the instance stores its data. The javadoc for the builder has more details.
### Replica Set
A replica set is similarly easy to configure:
```java
ReplicaSet replicaSet = ReplicaSet.builder().build();
```
This will build a basic three member replica set with member ports starting at 30000. The name of the replica set can be configured via
the builder as well as the size of the replica set.
### Sharding
Sharded clusters are also built via builder:
```java
ShardedCluster cluster = ShardedCluster.cluster().build();
```
This builds a sharded cluster with three replica sets each with three members, three config servers, and three mongoses. The mongos
isntances will be available starting at the default port of 30000.
## Versions
BottleRocket is intended to work with version of MongoDB 3.6 onward. The version to use when building the cluster can be set via
which builder is used to build your cluster. Mixed version clusters are not currently supported via the builders but are on the roadmap.
近期下载者:
相关文件:
收藏者: