【IPFS】IPFS部署分布式项目到应用服务器的实践

简介: 前言上一篇文章主要做了本地开发机的环境安装和demo运行,算是对IPFS有了一些认识,具体查看http://blog.csdn.net/diandianxiyu_geek/article/details/77171820,这次部署在对外网开放的服务器上,解决遇到的小问题和体会分布式部署到节点。

前言

上一篇文章主要做了本地开发机的环境安装和demo运行,算是对IPFS有了一些认识,具体查看http://blog.csdn.net/diandianxiyu_geek/article/details/77171820,这次部署在对外网开放的服务器上,解决遇到的小问题和体会分布式部署到节点。

服务器环境


//查看nginx版本
[root@xxxxxxxxxxxx ~]# nginx -v
nginx version: nginx/1.9.7

//查看php版本
[root@xxxxxxxxxxxxxxxxxx ~]# php -v
PHP 7.0.0 (cli) (built: Dec 10 2015 10:56:28) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

//查看mysql版本
[root@xxxxxxxxx ~]# mysql --help | grep Distrib 
mysql  Ver 14.14 Distrib 5.6.28, for Linux (x86_64) using  EditLine wrapper

实践

为了保证安装过程中失误造成不必要的损失,最好备份下服务器磁盘快照~

[root@xxxxxxxxx ipfs_zip]# wget https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
--2017-08-15 10:09:35--  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Resolving dist.ipfs.io (dist.ipfs.io)... 147.135.130.181, 217.182.195.23
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8580949 (8.2M) [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz0% [                                       ] 32,223      --.-K/s   in 0s      

2017-08-15 10:09:37 (132 MB/s) - Connection closed at byte 32223. Retrying.

--2017-08-15 10:09:38--  (try: 2)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8548726 (8.2M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz0% [                                       ] 64,389      --.-K/s   in 0s      

2017-08-15 10:09:39 (122 MB/s) - Connection closed at byte 64389. Retrying.

--2017-08-15 10:09:41--  (try: 3)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8516560 (8.1M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz1% [                                       ] 96,555      --.-K/s   in 0s      

2017-08-15 10:09:43 (119 MB/s) - Connection closed at byte 96555. Retrying.

--2017-08-15 10:09:46--  (try: 4)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8484394 (8.1M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz1% [                                       ] 128,721     --.-K/s   in 0s      

2017-08-15 10:09:47 (108 MB/s) - Connection closed at byte 128721. Retrying.

--2017-08-15 10:09:51--  (try: 5)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8452228 (8.1M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz1% [                                       ] 160,886     --.-K/s   in 0s      

2017-08-15 10:09:53 (111 MB/s) - Connection closed at byte 160886. Retrying.

--2017-08-15 10:09:58--  (try: 6)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8420063 (8.0M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz2% [                                       ] 193,051     --.-K/s   in 0s      

2017-08-15 10:09:59 (111 MB/s) - Connection closed at byte 193051. Retrying.

--2017-08-15 10:10:05--  (try: 7)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8387898 (8.0M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz2% [>                                      ] 225,216     --.-K/s   in 0s      

2017-08-15 10:10:07 (129 MB/s) - Connection closed at byte 225216. Retrying.

--2017-08-15 10:10:14--  (try: 8)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8355733 (8.0M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz2% [+                                      ] 257,381     --.-K/s   in 0s      

2017-08-15 10:10:15 (118 MB/s) - Connection closed at byte 257381. Retrying.

--2017-08-15 10:10:23--  (try: 9)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8323568 (7.9M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz3% [+                                      ] 289,546     --.-K/s   in 0s      

2017-08-15 10:10:25 (108 MB/s) - Connection closed at byte 289546. Retrying.

--2017-08-15 10:10:34--  (try:10)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8291403 (7.9M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz3% [+                                      ] 321,711     --.-K/s   in 0s      

2017-08-15 10:10:35 (115 MB/s) - Connection closed at byte 321711. Retrying.

--2017-08-15 10:10:45--  (try:11)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8259238 (7.9M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz4% [+                                      ] 353,876     --.-K/s   in 0s      

2017-08-15 10:10:46 (121 MB/s) - Connection closed at byte 353876. Retrying.

--2017-08-15 10:10:56--  (try:12)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8227073 (7.8M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz4% [+                                      ] 386,041     --.-K/s   in 0s      

2017-08-15 10:10:58 (131 MB/s) - Connection closed at byte 386041. Retrying.

--2017-08-15 10:11:08--  (try:13)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8194908 (7.8M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz4% [+                                      ] 418,206     --.-K/s   in 0s      

2017-08-15 10:11:09 (112 MB/s) - Connection closed at byte 418206. Retrying.

--2017-08-15 10:11:19--  (try:14)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8162743 (7.8M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz5% [+>                                     ] 450,371     --.-K/s   in 0s      

2017-08-15 10:11:21 (121 MB/s) - Connection closed at byte 450371. Retrying.

--2017-08-15 10:11:31--  (try:15)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8130578 (7.8M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz5% [++                                     ] 482,536     --.-K/s   in 0s      

2017-08-15 10:11:32 (125 MB/s) - Connection closed at byte 482536. Retrying.

--2017-08-15 10:11:42--  (try:16)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8098413 (7.7M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz5% [++                                     ] 514,701     --.-K/s   in 0s      

2017-08-15 10:11:44 (120 MB/s) - Connection closed at byte 514701. Retrying.

--2017-08-15 10:11:54--  (try:17)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8066248 (7.7M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz6% [++                                     ] 546,866     --.-K/s   in 0s      

2017-08-15 10:11:56 (124 MB/s) - Connection closed at byte 546866. Retrying.

--2017-08-15 10:12:06--  (try:18)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8034083 (7.7M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz6% [++                                     ] 579,031     --.-K/s   in 0.004s  

2017-08-15 10:12:07 (8.42 MB/s) - Connection closed at byte 579031. Retrying.

--2017-08-15 10:12:17--  (try:19)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 8001918 (7.6M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz7% [++                                     ] 611,196     --.-K/s   in 0s      

2017-08-15 10:12:19 (114 MB/s) - Connection closed at byte 611196. Retrying.

--2017-08-15 10:12:29--  (try:20)  https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-amd64.tar.gz
Connecting to dist.ipfs.io (dist.ipfs.io)|147.135.130.181|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 8580949 (8.2M), 7969753 (7.6M) remaining [application/x-gzip]
Saving to: ‘go-ipfs_v0.4.10_linux-amd64.tar.gz7% [++                                     ] 643,361     --.-K/s   in 0s      

2017-08-15 10:12:30 (128 MB/s) - Connection closed at byte 643361. Giving up.

Giving up了,官方安装包下载不下来,所以先下载在电脑上,再上传到服务器上。。。。。。

需要下载的文件

[root@xxxxxxxxxxxxxxxx ipfs_zip]# tar xvfz go-ipfs_v0.4.10_linux-amd64.tar.gz   //解压
go-ipfs/build-log
go-ipfs/install.sh
go-ipfs/ipfs
go-ipfs/LICENSE
go-ipfs/README.md
[root@xxxxxxx ipfs_zip]# mv go-ipfs/ipfs /usr/local/bin/ipfs   //移动执行文件
[root@xxxxxxxxx ipfs_zip]# ipfs help //执行命令,说明安装成功
USAGE
  ipfs - Global p2p merkle-dag filesystem.

  ipfs [--config=<config> | -c] [--debug=<debug> | -D] [--help=<help>] [-h=<h>] [--local=<local> | -L] [--api=<api>] <command> ...

SUBCOMMANDS
  BASIC COMMANDS
    init          Initialize ipfs local configuration
    add <path>    Add a file to IPFS
    cat <ref>     Show IPFS object data
    get <ref>     Download IPFS objects
    ls <ref>      List links from an object
    refs <ref>    List hashes of links from an object

  DATA STRUCTURE COMMANDS
    block         Interact with raw blocks in the datastore
    object        Interact with raw dag nodes
    files         Interact with objects as if they were a unix filesystem
    dag           Interact with IPLD documents (experimental)

  ADVANCED COMMANDS
    daemon        Start a long-running daemon process
    mount         Mount an IPFS read-only mountpoint
    resolve       Resolve any type of name
    name          Publish and resolve IPNS names
    key           Create and list IPNS name keypairs
    dns           Resolve DNS links
    pin           Pin objects to local storage
    repo          Manipulate the IPFS repository
    stats         Various operational stats
    p2p           Libp2p stream mounting
    filestore     Manage the filestore (experimental)

  NETWORK COMMANDS
    id            Show info about IPFS peers
    bootstrap     Add or remove bootstrap peers
    swarm         Manage connections to the p2p network
    dht           Query the DHT for values or peers
    ping          Measure the latency of a connection
    diag          Print diagnostics

  TOOL COMMANDS
    config        Manage configuration
    version       Show ipfs version information
    update        Download and apply go-ipfs updates
    commands      List all available commands

  Use 'ipfs <command> --help' to learn more about each command.

  ipfs uses a repository in the local file system. By default, the repo is located
  at ~/.ipfs. To change the repo location, set the $IPFS_PATH environment variable:

    export IPFS_PATH=/path/to/ipfsrepo

  EXIT STATUS

  The CLI will exit with one of the following values:

  0     Successful execution.
  1     Failed executions.


至此,安装完成。


[root@xxxxxxxxxx ipfs_zip]# ipfs init
initializing IPFS node at /root/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmdSkEjtdHsifEySmGZ9EGG3vpmSa4zNWG5oavuTvuyvPN
to get started, enter:

    ipfs cat /ipfs/QmVLDAhCY3X9P2uRudKAryuQFPM5zqA3Yij1dY8FpGbL7T/readme


[root@xxxxxxxx ipfs_zip]# ipfs cat /ipfs/QmVLDAhCY3X9P2uRudKAryuQFPM5zqA3Yij1dY8FpGbL7T/readme
Hello and Welcome to IPFS!

██╗██████╗ ███████╗███████╗
██║██╔══██╗██╔════╝██╔════╝
██║██████╔╝█████╗  ███████╗
██║██╔═══╝ ██╔══╝  ╚════██║
██║██║     ██║     ███████║
╚═╝╚═╝     ╚═╝     ╚══════╝

If you're seeing this, you have successfully installed
IPFS and are now interfacing with the ipfs merkledag!

 -------------------------------------------------------
| Warning:                                              |
|   This is alpha software. Use at your own discretion! |
|   Much is missing or lacking polish. There are bugs.  |
|   Not yet secure. Read the security notes for more.   |
 -------------------------------------------------------

Check out some of the other files in this directory:

  ./about
  ./help
  ./quick-start     <-- usage examples
  ./readme          <-- this file
  ./security-notes

[root@xxxxxxxxxx ipfs_zip]# ipfs cat  /ipfs/QmVLDAhCY3X9P2uRudKAryuQFPM5zqA3Yij1dY8FpGbL7T/quick-start
# 0.1 - Quick Start

This is a set of short examples with minimal explanation. It is meant as
a "quick start". Soon, we'll write a longer tour :-)


Add a file to ipfs:

  echo "hello world" >hello
  ipfs add hello


View it:

  ipfs cat <the-hash-you-got-here>


Try a directory:

  mkdir foo
  mkdir foo/bar
  echo "baz" > foo/baz
  echo "baz" > foo/bar/baz
  ipfs add -r foo


View things:

  ipfs ls <the-hash-here>
  ipfs ls <the-hash-here>/bar
  ipfs cat <the-hash-here>/baz
  ipfs cat <the-hash-here>/bar/baz
  ipfs cat <the-hash-here>/bar
  ipfs ls <the-hash-here>/baz


References:

  ipfs refs <the-hash-here>
  ipfs refs -r <the-hash-here>
  ipfs refs --help


Get:

  ipfs get <the-hash-here> -o foo2
  diff foo foo2


Objects:

  ipfs object get <the-hash-here>
  ipfs object get <the-hash-here>/foo2
  ipfs object --help


Pin + GC:

  ipfs pin add <the-hash-here>
  ipfs repo gc
  ipfs ls <the-hash-here>
  ipfs pin rm <the-hash-here>
  ipfs repo gc


Daemon:

  ipfs daemon  (in another terminal)
  ipfs id


Network:

  (must be online)
  ipfs swarm peers
  ipfs id
  ipfs cat <hash-of-remote-object>


Mount:

  (warning: fuse is finicky!)
  ipfs mount
  cd /ipfs/<the-hash-here>
  ls


Tool:

  ipfs version
  ipfs update
  ipfs commands
  ipfs config --help
  open http://localhost:5001/webui


Browse:

  webui:

    http://localhost:5001/webui

  video:

    http://localhost:8080/ipfs/QmVc6zuAneKJzicnJpfrqCH9gSy6bz54JhcypfJYhGUFQu/play#/ipfs/QmTKZgRNwDNZwHtJSjCp6r5FYefzpULfy37JvMt9DwvXse

  images:

    http://localhost:8080/ipfs/QmZpc3HvfjEXvLWGQPWbHk3AjD5j8NEN4gmFN8Jmrd5g83/cs

  markdown renderer app:

    http://localhost:8080/ipfs/QmX7M9CiYXjVeFnkfVGf3y5ixTZ2ACeSGyL1vBJY1HvQPp/mdown


[root@xxxxx ipfs_zip]# ipfs daemon //启动
Initializing daemon...
Swarm listening on /ip4/10.144.176.230/tcp/4001
Swarm listening on /ip4/115.28.190.53/tcp/4001
Swarm listening on /ip4/115.28.190.53/tcp/4001
Swarm listening on /ip4/127.0.0.1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
Error: serveHTTPGateway: manet.Listen(/ip4/127.0.0.1/tcp/8080) failed: listen tcp4 127.0.0.1:8080: bind: address already in use //端口占用,解决:修改配置文件,更改端口

[root@iZ2851te7e5Z ipfs_zip]# ipfs config //查看配置文件的命令
Error: Argument 'key' is required //报错暂时不管

USAGE
  ipfs config <key> [<value>] - Get and set ipfs config values.

  ipfs config [--bool] [--json] [--] <key> [<value>]

  'ipfs config' controls configuration variables. It works like 'git config'.
  The configuration values are stored in a config file inside your ipfs
  repository.

SUBCOMMANDS
  ipfs config edit           - Open the config file for editing in $EDITOR.
  ipfs config replace <file> - Replace the config with <file>.
  ipfs config show           - Output config file contents.

Use 'ipfs config --help' for more information about this command.

[root@xxxxxxxxx ipfs_zip]# ipfs config edit //修改配置文件
Error: ENV variable $EDITOR not set //没有设置默认编辑器
[root@xxxxxxxxxx ipfs_zip]# export EDITOR=vi  //修改默认编辑器
[root@xxxxxxxxxx ipfs_zip]# ipfs config edit //再次修改配置文件

修改配置文件中的AddressesGateway中的端口,这里改成了8081.

[root@iZ2851te7e5Z ipfs_zip]# ipfs daemon
Initializing daemon...
Swarm listening on /ip4/10.144.176.230/tcp/4001
Swarm listening on /ip4/115.28.190.53/tcp/4001
Swarm listening on /ip4/115.28.190.53/tcp/4001
Swarm listening on /ip4/127.0.0.1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8081
Daemon is ready

//运行成功

把上面的提示的地址换成自己服务器的IP,还是不能访问,原因在于配置问题。

[root@xxxxxxxxxx ipfs_zip]# ipfs config edit //再次修改配置文件

修改配置文件中的AddressesGateway`中的127.0.0.1改成0.0.0.0`.

还会出现的问题,dial tcp xxxxxx:8081: i/o timeout

问题总结

目前在服务器上出现以下问题:

  • 官网的安装包下载失败,一直在超时
  • 服务器运行ipfs后,没有打开过页面,一直出现IO的超时

可能造成这样的原因

  • IPFS官网以及官方提供的节点被阿里云墙了

解决思路:如果需要使用IPFS的服务,可以采用海外服务器作为服务的一个节点,构建分布式文件系统

目录
相关文章
|
2月前
|
弹性计算 监控 负载均衡
|
11天前
|
运维 数据挖掘 索引
服务器数据恢复—Lustre分布式文件系统服务器数据恢复案例
5台节点服务器,每台节点服务器上有一组RAID5阵列。每组RAID5阵列上有6块硬盘(其中1块硬盘设置为热备盘,其他5块硬盘为数据盘)。上层系统环境为Lustre分布式文件系统。 机房天花板漏水导致这5台节点服务器进水,每台服务器都有至少2块硬盘出现故障。每台服务器中的RAID5阵列短时间内同时掉线2块或以上数量的硬盘,导致RAID崩溃,服务器中数据无法正常读取。
|
2月前
|
弹性计算 开发工具 git
2分钟在阿里云ECS控制台部署个人应用(图文示例)
作为一名程序员,我在部署托管于Github/Gitee的代码到阿里云ECS服务器时,经常遇到繁琐的手动配置问题。近期,阿里云ECS控制台推出了一键构建部署功能,简化了这一过程,支持Gitee和GitHub仓库,自动处理git、docker等安装配置,无需手动登录服务器执行命令,大大提升了部署效率。本文将详细介绍该功能的使用方法和适用场景。
2分钟在阿里云ECS控制台部署个人应用(图文示例)
|
1月前
|
开发框架 .NET PHP
网站应用项目如何选择阿里云服务器实例规格+内存+CPU+带宽+操作系统等配置
对于使用阿里云服务器的搭建网站的用户来说,面对众多可选的实例规格和配置选项,我们应该如何做出最佳选择,以最大化业务效益并控制成本,成为大家比较关注的问题,如果实例、内存、CPU、带宽等配置选择不合适,可能会影响到自己业务在云服务器上的计算性能及后期运营状况,本文将详细解析企业在搭建网站应用项目时选购阿里云服务器应考虑的一些因素,以供参考。
|
2月前
|
NoSQL 容灾 MongoDB
MongoDB主备副本集方案:两台服务器使用非对称部署的方式实现高可用与容灾备份
在资源受限的情况下,为了实现MongoDB的高可用性,本文探讨了两种在两台服务器上部署MongoDB的方案。方案一是通过主备身份轮换,即一台服务器作为主节点,另一台同时部署备节点和仲裁节点;方案二是利用`priority`设置实现自动主备切换。两者相比,方案二自动化程度更高,适合追求快速故障恢复的场景,而方案一则提供了更多的手动控制选项。文章最后对比了这两种方案与标准三节点副本集的优缺点,指出三节点方案在高可用性和数据一致性方面表现更佳。
|
2月前
|
PHP 数据库 数据安全/隐私保护
布谷直播源码部署服务器关于数据库配置的详细说明
布谷直播系统源码搭建部署时数据库配置明细!
|
3月前
|
关系型数据库 MySQL Linux
基于阿里云服务器Linux系统安装Docker完整图文教程(附部署开源项目)
基于阿里云服务器Linux系统安装Docker完整图文教程(附部署开源项目)
590 3
|
3月前
|
NoSQL Java Redis
太惨痛: Redis 分布式锁 5个大坑,又大又深, 如何才能 避开 ?
Redis分布式锁在高并发场景下是重要的技术手段,但其实现过程中常遇到五大深坑:**原子性问题**、**连接耗尽问题**、**锁过期问题**、**锁失效问题**以及**锁分段问题**。这些问题不仅影响系统的稳定性和性能,还可能导致数据不一致。尼恩在实际项目中总结了这些坑,并提供了详细的解决方案,包括使用Lua脚本保证原子性、设置合理的锁过期时间和使用看门狗机制、以及通过锁分段提升性能。这些经验和技巧对面试和实际开发都有很大帮助,值得深入学习和实践。
太惨痛: Redis 分布式锁 5个大坑,又大又深, 如何才能 避开 ?
|
1月前
|
存储 NoSQL Java
使用lock4j-redis-template-spring-boot-starter实现redis分布式锁
通过使用 `lock4j-redis-template-spring-boot-starter`,我们可以轻松实现 Redis 分布式锁,从而解决分布式系统中多个实例并发访问共享资源的问题。合理配置和使用分布式锁,可以有效提高系统的稳定性和数据的一致性。希望本文对你在实际项目中使用 Redis 分布式锁有所帮助。
104 5
|
2月前
|
NoSQL Java 数据处理
基于Redis海量数据场景分布式ID架构实践
【11月更文挑战第30天】在现代分布式系统中,生成全局唯一的ID是一个常见且重要的需求。在微服务架构中,各个服务可能需要生成唯一标识符,如用户ID、订单ID等。传统的自增ID已经无法满足在集群环境下保持唯一性的要求,而分布式ID解决方案能够确保即使在多个实例间也能生成全局唯一的标识符。本文将深入探讨如何利用Redis实现分布式ID生成,并通过Java语言展示多个示例,同时分析每个实践方案的优缺点。
71 8