MongoDB University笔记总结 - M103_Chapter0:Introduction & Setup

关于MongoDB的学习计划

详见:https://blog.csdn.net/tyzh2010/article/details/111169621

 

本篇开始记录第二个课程的笔记

Source: MongoDB University   https://university.mongodb.com/

Course: M103: Basic Cluster Administration

 

【Chapter 0】: Chapter 0: Introduction & Setup

这一节的主要讲了Linux操作系统的基本知识

Key points:

Introduction to Linux Basics

  1. Basics of Linux Directory Structure
  2. Important Definitions
  3. Concept of users in Linux
  4. Commands You Should Know
  5. Linux process management

 

1.Basics of Linux Directory Structure

不同于Windows系统,所有的文件都存在了 C、D、E盘等等,Linux系统中,所有的文件存在于一个树的结构中,起始于一个root节点。 root路径包含了全部文件夹以及全部路径。

root的代表符号是 /

https://university-courses.s3.amazonaws.com/M103/Linux+tutorial/Linux+Directory+Structure.png

Root包含常用路径有 /bin, /etc, /home,/root, /var等。更多路径详见(https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard)

/etc : 包含了系统的配置文件, Contains the system configuration files for the host computer. You should be careful when making changes to the files contained in this directory.

/home: 包含了用户的个人文件。

/var: 包含变量相关的文件。例如log 和 loc文件夹

 

2.Important Definitions重要的定义

-当前工作路径,当登陆Linux系统的时候,默认当前工作路径是/home ,用pwd (Print work Directory) 命令可查看当前工作路径。

-绝对路径, 文件完整的路径,从root开始的的路径,

-相对路径,与当前工作路径相关的路径。

例如:

https://university-courses.s3.amazonaws.com/M103/Linux+tutorial/Absolute+Path+and+Relative+path.jpg

当前文件夹是 mongodb

绝对路径: /data/mongodb/database/db1    (从root开始,第一个/代表root

相对路径: database/db1

 

3.Concept of users in Linux

1)linux是多用户操作系统,同一时间多个用户可同时操作。

有三种用户:root、regular 、service

root user:是linux系统里的主要用户,有着最高权限,系统安装的时候自动生成。也可以被称为 superuser 或者 administrator

regular user: 正常的用户,有着适当的权利。

 

2)sudo 命令 代表 supersuer do,这个命令可以给普通用户赋予最高权利(root权利)

3)权限: read 、write、execute三种权限

chmod 命令可以修改权限,详见(https://en.wikipedia.org/wiki/Chmod

 

例:给m103-keyfile 修改权限为 read only.

chmod 400 /var/mongodb/pki/m103-keyfile

400代表着read-only权限,每个数字代表着一种权限。

  • 0 = no permissions whatsoever; this person cannot read, write, or execute the file
  • 1 = execute only
  • 2 = write only
  • 3 = write and execute (1+2)
  • 4 = read only
  • 5 = read and execute (4+1)
  • 6 = read and write (4+2)
  • 7 = read and write and execute (4+2+1)

详细见:https://www.december.com/unix/ref/chmod.html

4)所有权 Ownership

chown 命令可修改所有权

语法如下:

chown [new owner]:[group] <file name>

例:将/var/mongodb_directory的所有权更改为 myuser.

 sudo chown myuser:myuser /var/mongodb_directory

如果文件属于root,需要用到sudo

 

4.Commands You Should Know

1) mkdir 创建一个新的文件夹

语法如下:

mkdir [modifiers] <name of the directory>

例:

mkdir -p /db/mongodb_data/

-p 代表如何需要的话创造一个parent 路径

If db directory already exists then this command will create only mongodb_data directory. Otherwise it will create the missing directory as well.

例:

sudo mkdir -p /var/data

2)rm 删除一个路径

语法如下:

rm [options] [directory|file]

 

删除文件以及该文件下面的所有子文件,谨慎操作

rm -rf <directory name>

3)ls    The ls command is used to list information about files and directories within the file system. 

 

To get a long listing of every file in a directory, including the hidden files, use 

ls -la

4)cd 改变当前工作路径

语法如下:cd <directory>

 

5)cat 在termianl中查看文件

语法如下:cat <name of the file>

6)rm 从当前工作路径中移除某文件

语法如下:rm <file name>

5.Linux process management

1) ps命令

Linux中的 ps 命令是Process Status的缩写, ps 命令用来列出系统中当前运行的那些进程。 ps 命令可以列出当前进程的运行情况(状态、时间等信息)。

例:列出含有mongo的所有进程

ps -ef | grep mongo

参数

  • -e,-A 显示所有进程
  • -f 显示完整格式的输出

grep用来匹配字符

2)kill 命令

语法如下:kill <pid>

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
为什么会这样[user_mongo@nosql01 replicaset]$ cd /opt [user_mongo@nosql01 opt]$ ll total 0 drwxr-xr-x. 3 root root 25 Mar 16 17:08 servers drwxr-xr-x. 2 root root 51 Mar 16 17:10 software [user_mongo@nosql01 opt]$ tar -zxvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/MPL-2 tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/MPL-2: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/README tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/README: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos: Cannot open: No such file or directory tar: Exiting with failure status due to previous errors [user_mongo@nosql01 opt]$ tar -zcvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ tar: Cowardly refusing to create an empty archive Try `tar --help' or `tar --usage' for more information.
06-01

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值