Initializing DynamoDB Local with the following configuration:
Port: 8000
InMemory: false
DbPath: null
SharedDb: true
shouldDelayTransientStatuses: false
CorsParams: *
这取决于JDK版本。
DynamoDB可以接受其他命令参数,主要有以下几个:
-cors value
-dbPath value
-delayTransientStatuses
-help
-inMemory
-optimizeDbBeforeStartup
-port value
-sharedDb
docker@docker-cloud-r720:~/team/andy/nodejs/src/dynamodb$ java -jar DynamoDBLocal.jar -help
usage: java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar
[-port <port-no.>] [-inMemory] [-delayTransientStatuses]
[-dbPath <path>][-sharedDb] [-cors <allow-list>]
-cors <arg> Enable CORS support for javascript against a
specific allow-list list the domains separated
by , use '*' for public access (default is
'*')
-dbPath <path> Specify the location of your database file.
Default is the current directory.
-delayTransientStatuses When specified, DynamoDB Local will introduce
delays to hold various transient table and
index statuses so that it simulates actual
service more closely. Currently works only for
CREATING and DELETING online index statuses.
-help Display DynamoDB Local usage and options.
-inMemory When specified, DynamoDB Local will run in
memory.
-optimizeDbBeforeStartup Optimize the underlying backing store database
tables before starting up the server
-port <port-no.> Specify a port number. Default is 8000
-sharedDb When specified, DynamoDB Local will use a
single database instead of separate databases
for each credential and region. As a result,
all clients will interact with the same set of
tables, regardless of their region and
credential configuration. (Useful for
interacting with Local through the JS Shell in
addition to other SDKs)
DynamoDB的执行速度,仅仅与本地机器配置有关。即便采用了延时参数,那么有些操作也会比实际DynamoDB Web Service要快得多。例如CreateTable和DeleteTable几乎都是瞬间完成,数据库中的表几乎都是ACTIVE状态。只有当UpdateTable影响到全局二级索引时,会有短暂的CREATING和DELETING状态,很快就会恢复为ACTIVE状态。而在实际DynamoDB服务中,这些都会消耗大量的时间。