阿里云怎么备份所有(阿里云服务器可以随时备份吗)
怎么用git把阿里云的数据备份下来
使用阿里云Ubuntu 12.0.4 64位操作系统做git服务器。首先git服务器有两种访问方式可以选择:http方式和ssh的方式,http方式更容易使用。
1、http方式的git服务器搭建以及使用git命令行访问:
On the Server
1) Install Ubuntu Server, this is the base of our git server obviously
2) Now we need to install a couple of packages, these being‘git-core’ and‘apache2′, we do this like so:-
apt-get update
apt-get install apache2 git-core
3) Now we need to create a new folder for your new repository and set some inital permissons, we do this like so:-
cd/var/www
mkdir test-repo.git
cd test-repo.git
git--bare init
git update-server-info
chown-R www-data.www-data.
4) We now need to enable WebDAV on Apache2 of which we will use to serve the repository:-
a2enmod dav_fs
5) We now need to configure the access restrictions to our repository by creating the following file:-/etc/apache2/conf.d/git.conf
Then fill it in with the following content:-<Location/test-repo.git> DAV on AuthType Basic AuthName"Git" AuthUserFile/etc/apache2/passwd.git Require valid-user</Location>
Then save and close the file, lets move on to the next bit..
6) Next we need to create a user account of which you will need to use to browse of commit to the repository..
htpasswd-c/etc/apache2/passwd.git<user>
You could then be prompted to enter the password for the user too and confirm it!
7) Ok that’s it for the server side configuration… we just need to restart Apache2 like so and then we should be ready to move on to the client side stuff!/etc/init.d/apache2 restart…you can now move on to the client side stuff!
On the client side
Ok so now we need to create a local(on your desktop machine) repository and then we’ll initiate the new remote repository… So, if your using Linux/MacOSX bring up the terminal and type the following commands:-
mkdir~/Desktop/test-project
cd~/Desktop/test-project
git init
git remote add origin<user>@<server name or IP address>/test-project.git
touch README
git add.
git commit-a-m“Initial import”
git push origin master
Done!– Your intiial file named‘README’ which currently is just blank has now been committed and you’ve pushed your code to your new git server which has now completed the Git reposity creation process, now in future you can‘clone’ your resposity like so:-
git clone<user>@<server name or IP address>/test-project.git注意上面连接<user>@<server name or IP address>/test-project.git中的user就是你htpasswd-c/etc/apache2/passwd.git<user>输入的用户名。另外新建仓库的时候,只需执行:
cd/var/www
mkdir项目名
cd项目名
git--bare init
git update-server-info
chown-R www-data.www-data.然后在/etc/apache2/conf.d/git.conf中对应添加上面类似段即可。其中:
AuthUserFile密码文件名后面的文件就是你指定的密码文件,你可以
htpasswd-c密码文件名<user>对应指定该项目的用户名和密码即可。添加用户是不要-c参数:
htpasswd密码文件名<user>
如何将阿里云的mysql(RDS)数据备份到本地
本例以本地服务器为 RHEL6/x64系统,备份文件存储路径为/home/mysql/为例。
下载云数据库物理备份文件并上传至目标服务器。备份文件获取方法请参见下载备份数据。如果目标服务器可以访问源实例,您也可以使用wget"url"下载备份文件。其中url为备份文件下载地址。
切换路径到备份文件所在路径。
cd/home/mysql/
解压备份文件。
其中,filename.tar.gz为备份文件名。
tar vizxf filename.tar.gz
检查解压后文件包含的数据库是否正确。
系统显示如下,其中db0dz1rv11f44yg2、mysql和test为云数据库中存在的数据库。
-rw-r--r-- 1 root root 269 Aug 19 18:15 backup-my.cnf
drwxr-xr-x 2 root root 4096 Aug 21 10:31 db0dz1rv11f44yg2
-rw-rw---- 1 root root 209715200 Aug 7 10:44 ibdata1
drwxr-xr-x 2 root root 4096 Aug 21 10:31 mysql
drwxr-xr-x 2 root root 4096 Aug 21 10:31 test
-rw-r--r-- 1 root root 10 Aug 19 18:15 xtrabackup_binary
-rw-r--r-- 1 root root 23 Aug 19 18:15 xtrabackup_binlog_info
-rw-r--r-- 1 root root 77 Aug 19 18:15 xtrabackup_checkpoints
-rw-r--r-- 1 root root 2560 Aug 19 18:15 xtrabackup_logfile
-rw-r--r-- 1 root root 72 Aug 19 18:15 xtrabackup_slave_info
cd filename/
ll
恢复数据文件。
系统显示innobackupex: completed OK!,则数据恢复成功。
innobackupex--defaults-file=./backup-my.cnf--apply-log./
修改配置文件。将解压文件backup-my.cnf中的innodb_fast_checksum、innodb_page_size、innodb_log_block_size注释掉,并且添加datadir=/home/mysql,如下所示。
# This MySQL options file was generated by innobackupex-1.5.1.
# The MySQL Server
[mysqld]
innodb_data_file_path=ibdata1:200M:autoextend
innodb_log_files_in_group=2
innodb_log_file_size=524288000
#innodb_fast_checksum=0
#innodb_page_size=16364
#innodb_log_block_size=512
datadir=/home/mysql/
重装 MySQL系统库,取得数据库的 root权限。
系统显示如下,则 mysql系统库重装成功。
Installing MySQL system table...
OK
Filling help table...
OK
rm-rf mysql
mysql_install_db--user=mysql--datadir=/home/mysql/
修改文件属主。
chown-R mysql:mysql/home/mysql/
启动 mysqld进程。
mysqld_safe--defaults-file=/home/mysql/backup-my.cnf&
使用客户端登录数据库。
mysql–u root–p
验证数据库是否完整。
系统显示入选,则数据库恢复成功。
+--------------------+
| Database|
+--------------------+
| information_schema|
| db0dz1rv11f44yg2|
| mysql|
| performance_schema|
| test|
+--------------------+
show databases;
阿里云 如何进行数据备份
阿里云可以将云服务器上的数据备份到本地,阿里云进行数据备份的具体操作步骤如下:
1、首先进入阿里云首页,右上角点击【登录】。
2、输入阿里云的帐号、密码,点击【登录】。
3、点击右上角的【控制台】。
4、点开左上角九个小正方形组成的正方形图标。
5、点击【云服务器ECS】。
6、在云服务器ECS下面点击【实例】。
7、在实例列表里面找到你要备份的实例,在实例右边点击【更多】目录下的【磁盘和镜像】,再【创建自定义镜像】。
8、填写自定义镜像的名称和描述,点击【创建】。
9、点击左边的【快照和镜像】目录下的【镜像】,在镜像列表里可以看到刚刚创建的镜像,等待进度到达100%、状态为可用时,数据就备份好了。