当前位置: 首页 > news >正文

夜月直播下载直播潍坊seo推广

夜月直播下载直播,潍坊seo推广,网站用asp还是php,顺德新网站建设目录 一、理论 1.MongoDB 二、实验 1.Ubuntu 20.04 安装MongoDB 三、问题 1.Ubuntu Linux的apt 包管理器更新安装软件报错 2.Ubuntu20.04安装vim报错 3.Ubuntu20.04如何更换阿里源 4.Ubuntu22.04如何更换阿里源 一、理论 1.MongoDB (1)概念 …

目录

一、理论

1.MongoDB

二、实验

1.Ubuntu 20.04 安装MongoDB

三、问题

1.Ubuntu Linux的apt 包管理器更新安装软件报错

2.Ubuntu20.04安装vim报错

3.Ubuntu20.04如何更换阿里源

4.Ubuntu22.04如何更换阿里源


一、理论

1.MongoDB

(1)概念

MongoDB 是由C++语言编写并基于分布式文件存储的开源数据库,属于NOSQL 。

MongoDB 是一款介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的NOSQL数据库。它面向文档存储,而且安装和操作起来都比较简单和容易,而且它支持各种流行编程语言进行操作,如Python,Node.js,Java,C++,PHP,C#等。

目前在大数据、内容管理、持续交付、移动应用、社交应用、用户数据管理、数据中心等领域皆有广泛被使用。

(2)MongoDB相对于RDBMS的优势

1)   无固定结构 。2)  数据结构由键值(key=>value)对组成。MongoDB 的文档类似于 JSON 对象。字段值可以包含其他文档,数组及文档数组,单个对象的结构是清晰的。3)   没有复杂的表连接。不需要维护表与表之间的内在关联关系。4)   查询功能强大。MongoDB的查询功能几乎与SQL一样强大,使用基于文档的查询语言,可以对文档进行动态查询。5)   易于调优和扩展。具备高性能、高可用性及可伸缩性等特性6)   应用程序对象与数据库对象天然对应。7)   可以基于内存存储或者硬盘文件存储,提供丰富的查询操作和索引支持,也有事务操作,可以更快地更稳定的访问数据。(mongoDB4.0以后才真正支持所谓的多文档事务操作)

(3)术语对比

表1 SQL与MongoDB对比

SQLMongodb
库(database)库(database)
表(Table)集合(Collection)
行/记录(Row)文档(Document)
列/字段(Col)字段/键/域(Field)
主键(Primary Key)对象ID(ObjectId)
索引(Index)索引(Index)

(4)基本操作

db.help()                    help on db methods   查看操作数据的方法db.mycoll.help()             help on collection methods  查看集合的操作方法sh.help()                    sharding helpers  查看分片集share的帮助信息rs.help()                    replica set helpers 查看复制集的帮助信息help admin                   administrative help 查看管理的操作帮助信息help connect                 connecting to a db helphelp keys                    key shortcutshelp misc                    misc things to knowhelp mr                      mapreduceshow dbs                     show database names  查看当前系统所有的数据库show collections             show collections in current database 查看当前数据库所有的数据集合show users                   show users in current database  查看当前数据库中所有的管理员用户show profile                 show most recent system.profile entries with time >= 1msshow logs                    show the accessible logger names 查看全部日志show log [name]              prints out the last segment of log in memory, 'global' is default                          查看指定日志信息use <db_name>                set current database   切换操作的数据库db.mycoll.find()             list objects in collection mycoll  列出当前指定集合下的所有文档db.mycoll.find( { a : 1 } )  list objects in mycoll where a == 1 按条件查询指定集合下所有文档it                           result of the last line evaluated; use to further iterate查看更多的查询结果,相当于下一页DBQuery.shellBatchSize = x   set default number of items to display on shell修改返回结果数据的单页显示数量,默认20条exit                         quit the mongo shell  退出终端

二、实验

1.Ubuntu 20.04 安装MongoDB

(1)安装依赖包

sudo apt-get install -y libcurl4 openssl

(2)关闭和卸载原有的mongodb

sudo systemctl stop mongod
sudo apt-get purge mongodb*
sudo apt-get auto-remove
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb

(3)导入包管理系统使用的公钥

# 导入包管理系统使用的公钥
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
# 如果命令执行结果没有显示OK,则执行此命令在把上一句重新执行:sudo apt-get install gnupg

(4)注册mongodb源

echo "deb https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
# echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

(5)更新源

sudo apt-get update

(6)安装mongodb

sudo apt-get install -y mongodb-org

(7)创建数据存储目录

sudo mkdir -p /data/db

(8)启动和关闭MongoDB

# 重新加载配置,并启动mongodb
sudo systemctl daemon-reload
sudo systemctl start mongod# 查看运行状态
sudo systemctl status mongod
# 如果mongodb状态为stop,则运行 sudo systemctl enable mongod# 停止mongodb
sudo systemctl stop mongod# 重启mongodb
sudo systemctl restart mongod

(9)进入交互终端

root@node1:/etc/apt# mongo
MongoDB shell version v4.4.25
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("3a390cc8-34b9-4160-bfe5-ddcd5149a056") }
MongoDB server version: 4.4.25
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, seehttps://docs.mongodb.com/
Questions? Try the MongoDB Developer Community Forumshttps://community.mongodb.com
---
The server generated these startup warnings when booting: # 警告:强烈建议使用XFS文件系统,并使用WiredTiger存储引擎。# 解释:因为当前ubuntu使用的是ext4文件系统,mongodb官方建议使用XFS文件系统功能更能发挥mongodb的性能,忽略不管2023-11-26T18:37:17.202-08:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem# 警告:当前mongodb没有为数据库启用访问控制。对数据和配置的读写访问是不受限制的。# 解释:后面会创建数据库用户采用密码登陆的。暂时不用管2023-11-26T18:37:17.594-08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
---

(10)查看默认库

> db
test
> show db;
uncaught exception: Error: don't know how to show [db] :
shellHelper.show@src/mongo/shell/utils.js:1145:11
shellHelper@src/mongo/shell/utils.js:819:15
@(shellhelp2):1:1
> show dbs;
admin   0.000GB
config  0.000GB
local   0.000GB
> 

(11)退出交互终端

exit
# quit()

(12)查看版本

mongo --version
# 或者终端内部使用 version()

三、问题

1.Ubuntu Linux的apt 包管理器更新安装软件报错

(1)报错

Could not get lock /var/lib/dpkg/lock-frontend

(2)原因分析

因为某些程序在系统后台进行着某些 apt 操作,因此锁定了 apt 数据库,所以暂时不能进行 apt 操作。就像windows上某程序或文件被另一进程所占有时,其他进程也无法访问一样,这是符合设计逻辑的。

(3)解决方法

首先找出是哪个进程占用了锁文件 /var/lib/dpkg/lock

root@node1:~# sudo lsof /var/lib/dpkg/lock
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfOutput information may be incomplete.
COMMAND      PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
unattende 163898 root   11uW  REG    8,5        0 787519 /var/lib/dpkg/l

接着kill 掉这个进程

root@node1:~# sudo kill -9 163898

然后删除锁文件

root@node1:~# sudo rm /var/lib/dpkg/lock

最后运行以下命令

root@node1:~# sudo dpkg --configure -a

2.Ubuntu20.04安装vim报错

(1)报错

(2)原因分析

vim : 依赖: vim-common (= 2:8.0.1453-1ubuntu1) 但是 2:8.1.2269-1ubuntu5.7 正要被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

(3)解决方法

apt-get purge vim-common
apt install vim

3.Ubuntu20.04如何更换阿里源

(1)查看系统信息

root@master1:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename:	focal

(2)先备份下原始源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

(3)修改文件   

sudo vim  /etc/apt/source.list

清除原有的,替换以下源

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal universe
deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe
deb http://mirrors.aliyun.com/ubuntu/ focal multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-security universe
deb http://mirrors.aliyun.com/ubuntu/ focal-security multiverse

(4)保存下,更新软件库

sudo  apt update

(5)升级软件

sudo  apt upgrade

4.Ubuntu22.04如何更换阿里源

(1)查看系统信息

root@ubuntu2204:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy

(2)先备份下原始源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

(3)修改文件   

sudo vim  /etc/apt/source.list

清除原有的,替换以下源

deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

(4)保存下,更新软件库

sudo  apt update

(5)升级软件

sudo  apt upgrade

5.mongod和mongo的区别

(1)区别

1)mongod
它是处理MongoDB系统的主要进程。主要负责处理数据请求,管理数据存储,和执行后台管理操作。当我们运行mongod命令意味着正在启动MongoDB进程, 并且在后台运行。2)mongo
它是一个命令行实现的客户端操作mongodb的工具,用于连接一个特定的mongod实例。当我们没有带参数运行mongo命令它将使用默认的localhost:27017和mongod进行连接。

http://www.zhongyajixie.com/news/35345.html

相关文章:

  • 珠海企业医疗网站建设免费数据查询网站
  • 危险网站怎么办给企业做网站的公司
  • 企业年报系统登录津seo快速排名
  • 促销策划seopc流量排名官网
  • 石家庄网站开发报价新产品市场推广方案
  • 湘潭响塘乡建设局网站天津网站推广
  • 动态交互网站建设网站怎么做出来的
  • 布吉网站建设搜索引擎优化的主要内容
  • 自己域名做网站搜索引擎优化指南
  • 建网站的公司起什么名好他达拉非功效与作用主要会有哪些
  • 做网站赚多少百度一下 你就知道官网 新闻
  • 辽阳建设银行网站阜新网站seo
  • php除了做网站还能做什么湖南搜索引擎推广平台
  • 站长工具seo综合查询工具今日重大新闻
  • 网站轮播效果怎么做的优化工具箱下载
  • 猎头公司收费标准抚州网站seo
  • 做男性服装的网站今日新闻十大头条内容
  • 一级域名做网站的好处千度搜索引擎
  • 四川手机网站开发怎么做推广让别人主动加我
  • 一个好的网站怎样布局百度搜索引擎广告
  • 做照片用的视频模板下载网站好黄页网站推广公司
  • wordpress最好用的编辑器南宁网站运营优化平台
  • 网页设计毕业论文参考文献上海优化外包
  • 温州微网站制作哪里有google海外版入口
  • 做海外房产最好的网站seo中文意思
  • 南皮网站建设网络营销过程步骤
  • 东莞佳诚网站建设有限公司如何推广外贸型网站
  • 哪里有零基础网站建设教学服务云计算培训
  • 吉林省人民政府门户网站网页推广怎么做的
  • 企业微信官方网站如何制作视频网站