Docker Hub
快速开始
Starting a TimescaleDB instance, pulling our Docker image from Docker Hub if needed.
如果需要的话,开始TimescaleDB实例时可以从Docker Hub拉取Docker image(镜像)。
docker run -d --name timescaledb -p 5432:5432 timescale/timescaledb
If you have PostgreSQL client tools (e.g., psql) installed locally, you can use those to access the Timescale docker instance. Otherwise, and probably simpler given default PostgreSQL access-control settings, you can connect using the instance's version of psql within the container (NOTE: for Windows this is necessary):
如果本地安装了PostgreSQL客户端工具(例如:psql),可以使用这些工具访问 Timescale Docker实例。否则,可以使用container(容器)内psql实例的版本连接更为简单的PostgreSQL数据库的默认访问控制设置。
docker exec -it timescaledb psql -U postgres
更多详细指令
Our Docker image is derived from the official Postgres image and includes alpine Linux as its OS.
我们的Docker镜像来源于官方Postgres镜像,操作系统为alpine Linux
While the above run command will pull the Docker image on demand, you can also explicitly pull our image from Docker Hub
可以通过上述命令拉取需要的Docker镜像,也可以直接从Docker Hub上直接拉取镜像。
docker pull timescale/timescaledb:latest
When running a Docker image, if one prefers to store the data in a host directory or wants to run the docker image on top of an existing data directory, then you can also specify a directory where a data volume should be stored/mounted via the
-v
flag. In particular, the abovedocker run
command should now include some additional argument such as-v /your/data/dir:/var/lib/postgresql/data.
如果你想在现有数据目录中运行Docker镜像,或者想在运行镜像时将数据存储在主目录,那么你可以指定一个需要通过-v
flag存储/挂载数据列的目录。上述docker run
命令现在应该包括一些额外的参数,如-/your/data/dir:/var/lib/postgresql/data.
This command is also included as
docker-run.sh
in the scripts/
of our github repo, which saves the data to $PWD/data
and also includes additional -c
flags we recommend for memory settings, etc.
该命令是我们github仓库scripts/
中的docker-run.sh
,它可以将数据存储在$PWD/data
中,它还包含我们推荐的存储设置-c
flags等。
Note that creating a new container (
docker run
) will also create a new volume unless an existing data volume is reused by reference via the-v
parameter (e.g., -v VOLUME_ID:/var/lib/postgresql/data). Existing containers can be stopped (docker stop) and started again (docker start) while retaining their volumes and data. Even if a docker container is deleted (docker rm) its data volume persists on disk until explicitly removed. Use docker volume ls to list the existing docker volumes. (More information on data volumes)
请注意,除非通过-v
参数(e.g., -v VOLUME_ID:/var/lib/postgresql/data)复用现有的数据列,要不然每创建一个新的容器(docker run
)都会创建一个新的列。保存现有容器的列和数据时,可以停止(docker stop
)和启动(docker start
)容器。删除(docker rm
)容器后,如果没有移除容器中的数据列,数据列将保留在disk
中。使用dokcer volumn ls
将现有docker columns 编列成表。
Prebuilt with PostGIS
We have also published a Docker image that comes prebuilt with PostGIS. This image is published under the name timescale/timescaledb-postgis rather than timescale/timescaledb. To download and run this image, follow the same instructions as above, but use this image name instead.
我们还发布了一个通过PostGIS预先创建的Docker镜像。使用以上命令下载并运行此镜像,注意修改镜像名称。该镜像的名字是timescale/timescaledb-postgis
而非timescale/timescaledb
。
Then just add the extension from the psql command line:
接下来只需要从psql
名两行添加扩展。
CREATE EXTENSION postgis;
For more instructions on using PostGIS, see our tutorial.
更多PostGIS的使用说明请参见tutorial章节。
Next we will setup the database, either with an empty hypertable, or by migrating data from another source
接下来,设置数据库,可以使用一个空的hypertable,也可以从另一个数据库中迁移数据。
局限性
For a list of currently known limitations, please see our Github page:
局限性详见Github
- Github issues