当前位置:网站首页>Docker - DB2 database deployment through container installation tutorial
Docker - DB2 database deployment through container installation tutorial
2022-07-22 19:56:00 【Network stupid pig】
Docker - Install and deploy through container DB2 Database tutorial
I've written a document about how to use DB2 The official installation procedure DB2 Database installation ( Click to see ). This article introduces another way : adopt Docker To quickly build DB2 Database environment , Using this method can save a lot of trouble in installation and configuration , Convenient and quick .
1, Pull the mirror image
(1) First, execute the following command to download the image to the local :
1 |
|
(2) Because the image is bigger (2.69G), Execute the following command to delete all dangling Data volume ( It's useless Volume), Avoid the lack of space :
1 |
|
2, Start the container
(1) Execute the following command to instantiate DB2 service : Parameter description :
- -d: Means to start the container in the background ;
- -p 50000:50000: Inside the container 50000 Port mapping host 50000 port ;
- --name db2: Name the container db2
- --privileged=true: Make the inside of the container root Have real root jurisdiction .
- -e DB2INST1_PASSWORD=marco-1234: Set the built-in instance user db2inst1 The password for marco-1234
- -e DBNAME=testdb: A container named testdb The database of , If this parameter is not specified, the database will not be created
- -e LICENSE=accept: Acceptance of agreement
- -v /usr/local/db2:/database: Mount Directory , among /usr/local/db2 It's the host Directory
1 |
|
(2) perform docker ps Command to confirm that the container started successfully .
3, Carry out orders
(1) First execute the following command to enter DB2 Instance in the command environment :
1 |
|
(2) Execute the following command to switch to the instance user db2inst1:
Be careful : Be sure to write the middle bar (-).
1 |
|
(3) Execute the following command to view the running status :
1 |
|
(4) Execute the following command to view the database and patch version :
1 |
|
(5) Execute the following command to view the created database , It can be found that according to the configuration parameters at startup , Currently create one testdb database :
1 |
|
(6) Execute the following command to connect testdb database :
1 |
|
(7) Then execute the following command to create a file named TEST Table of :
Be careful :db2 After the order sql Statements need to be enclosed in quotation marks , No, it will be reported -bash: syntax error near unexpected token `(' error .
1 |
|
(8) Execute the following command to view all user tables , You can find TEST Table created successfully :
1 |
|
(9) We can also execute the following command to create another SAMPLE database ( Sample database )
1 |
|
(10) Then execute again db2 list dbdirectory The command can see that the database is created successfully :
(11) Finally, execute exit You can exit the container , Return to the host .
4, Carry out orders
DB2 Database common command learning
边栏推荐
猜你喜欢
One master-slave replication of MySQL
MySQL converts milliseconds into time string
pyinstaller打包scrapy
Mysql之一主多从复制
linux开启MySQL binlog日志
AForge “未能加载文件或程序集“AForge.Video.FFMPEG.dll”或它的某一个依赖项。找不到指定的模块”
C WinForm DataGridView column full width
Spark loads CSV and JSON files (attached to the virtual machine to execute the jar package)
AForge "failed to load the file or assembly" aforge.video.ffmpeg.dll "or one of its dependencies. The specified module cannot be found "
JVM-jstat(虚拟机统计信息监视工具)的使用
随机推荐
Summary of MySQL grant user permissions
leetcode 300. 最长递增子序列
Win10图标变白纸了,恢复方法
Summary of MySQL import and export methods using mysqldump
NC4 判断链表中是否有环
IO models you often encounter
AttributeError: module ‘tensorflow.keras.utils‘ has no attribute image_dataset_from_directory——解决方法
getchar的使用
Spark RDD算子:分区操作,mapPartitions和mapPartitionsWIthIndex
Spark loads CSV and JSON files (attached to the virtual machine to execute the jar package)
Datablau5.0 data asset management product series heavy release
NiO character set and charset
Spark加载CSV和JSON文件(附在虚拟机中执行jar包)
NC27 集合的所有子集(一)
Vs Code common shortcut keys
NFT卡牌链游系统Dapp开发搭建
Vs2017 project changed to VS2010
promise
leetcode 22. 括号生成
数据仓库模型设计与工具