Home > Backend Development > PHP Tutorial > Quickly build a WordPress blog system in ten minutes

Quickly build a WordPress blog system in ten minutes

步履不停
Release: 2023-04-06 20:28:01
Original
4885 people have browsed it

Quickly build a WordPress blog system in ten minutes

Introduction

The first website project that many Internet application developers come into contact with is the blog system. WordPress, the most widely used language in the world, is often used by users to quickly build personal blog sites. By default, WordPress generally uses the MySQL relational database in the background to store all blog posts and replies. This article will show how to use SequoiaDB to replace MySQL and become the backend relational database of the WordPress blog system.

By reading this article, users can learn how to use the MySQL instance of SequoiaDB to seamlessly replace the standard MySQL database. SequoiaDB allows users to directly migrate existing applications to background MySQL databases without changing a line of code.

By using SequoiaDB Jushan database, users can get:

Horizontal elastic expansion 100% fully compatible with MySQL excellent transaction performance

WordPress is a blogging platform developed using PHP language. Users can set up their own website on a server that supports PHP and MySQL databases, or use WordPress as a content management system (CMS).

WordPress has many free templates developed by third parties, and the installation method is simple and easy to use. At the same time, WordPress officially supports the Chinese version and has thousands of various plug-ins and countless theme template styles.

Quickly build a WordPress blog system in ten minutes

Installing SequoiaDB

This article uses Linux Ubuntu Server 18.10 as the server, and the SequoiaDB database version is 3.2.1.

The default sudo username and password for this tutorial is "sequoiadb:sequoiadb", and the default home path is /home/sequoiadb.

For users using other Linux versions such as CentOS, the process described in this article may be slightly different and need to be adjusted according to the actual situation.

1) Download and install SequoiaDB Giant Sequoia Database

$ wget http://cdn.sequoiadb.com/images/sequoiadb/x86_64/sequoiadb-3.2.1-linux_x86_64.tar.gz
$ tar -zxvf sequoiadb-3.2.1-linux_x86_64.tar.gz
$ cd sequoiadb-3.2.1/
$ sudo ./setup.sh
Copy after login

and then press Enter to confirm each default parameter.

Use the database instance user to create a default instance

$ sudo su sdbadmin
$ /opt/sequoiadb/tools/deploy/quickDeploy
Copy after login

3) Connect to the database and enable the transaction function and set the default isolation level RC

$ /opt/sequoiadb/bin/sdb
> db = new Sdb() ;
> db.updateConf ( { transactionon: true, transisolation: 1 } ) ;
> quit ;
$ /opt/sequoiadb/bin/sdbstop
$ /opt/sequoiadb/bin/sdbstart
Copy after login

Install Apache and PHP

Update system packages and install Apache and PHP

$ sudo apt-get update
$ sudo apt-get install apache2 php libapache2-mod-php php-mysql unzip php-xml
Copy after login

Install WordPress

This tutorial uses WordPress 5.2.1.

1) Log in to the WordPress official website download page

Quickly build a WordPress blog system in ten minutes or log in as sequoiadb user and use wget to download the installation package

$ wget https://wordpress.org/wordpress-5.2.1.tar.gz
Copy after login

2)安装Wordpress并配置

$ tar -zxvf wordpress-5.2.1.tar.gz
$ cd wordpress
$ sudo rm /var/www/html/*
$ sudo cp -R * /var/www/html/
$ sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
$ sudo chown www-data:www-data /var/www/html/*
Copy after login

3)更改配置文件

$ sudo vi /var/www/html/wp-config.php
define( 'DB_NAME', 'database_name_here' ); 变为  define( 'DB_NAME', 'wordpress’ );
define( 'DB_USER', 'username_here' );      变为  define( 'DB_USER', ‘sequoiadb’ );
define( 'DB_PASSWORD', 'password_here' ); 变为  define( 'DB_PASSWORD', 'sequoiadb' );
define( &#39;DB_HOST&#39;, &#39;localhost&#39; );           变为  define( &#39;DB_HOST&#39;, ‘<服务器IP地址>’ );
Copy after login

创建Wordpress数据库

$ sudo su sdbadmin
$ /opt/sequoiasql/mysql/bin/mysql -S /opt/sequoiasql/mysql/database/3306/mysqld.sock -u root
mysql> create user &#39;sequoiadb&#39;@&#39;localhost&#39; identified by &#39;sequoiadb&#39;;
mysql> create database wordpress;
mysql> grant all on wordpress.* to ‘sequoiadb&#39;@’localhost&#39;;
mysql> grant all privileges on *.* to &#39;sequoiadb&#39;@&#39;%&#39; identified by &#39;sequoiadb&#39; with grant option;
mysql> exit
Copy after login

确认表被分散在多个分区

$ /opt/sequoiadb/bin/sdb
> db=new Sdb() ;
> db.snapshot(SDB_SNAP_CATALOG) ;
……
{
  "_id": {
    "$oid": "5cecf121116eae6117df17dc"
  },
  "Name": "wordpress.wp_posts",
  "UniqueID": 4294967308,
  "Version": 1,
  "ReplSize": -1,
  "Attribute": 1,
  "AttributeDesc": "Compressed",
  "CompressionType": 1,
  "CompressionTypeDesc": "lzw",
  "ShardingKey": {
    "ID": 1
  },
  "EnsureShardingIndex": false,
  "ShardingType": "hash",
  "Partition": 4096,
  "InternalV": 3,
  "CataInfo": [
    {
      "ID": 0,
      "GroupID": 1000,
      "GroupName": "group1",
      "LowBound": {
        "": 0
      },
      "UpBound": {
        "": 1365
      }
    },
    {
      "ID": 1,
      "GroupID": 1001,
      "GroupName": "group2",
      "LowBound": {
        "": 1365
      },
      "UpBound": {
        "": 2730
      }
    },
    {
      "ID": 2,
      "GroupID": 1002,
      "GroupName": "group3",
      "LowBound": {
        "": 2730
      },
      "UpBound": {
        "": 4096
      }
    }
  ],
  "AutoSplit": true,
  "AutoIncrement": [
    {
      "SequenceName": "SYS_4294967308_ID_SEQ",
      "Field": "ID",
      "Generated": "default",
      "SequenceID": 11
    }
  ]
}
……
Copy after login

其中针对每个表的CataInfo字段为该表分散在不同分区的一致性散列范围,而分区键则为ShardingKey字段。对于wp_posts来说,其表结构显示数据根据ID字段进行散列切分,数据被打散至集群的三个分区中。

配置Wordpress

通过浏览器登录服务器IP地址

Quickly build a WordPress blog system in ten minutes

  1. Site Title: SDBWordpress

  2. Username: sequoiadb

  3. Password: sequoiadb

  4. 选择Confirm use of weak password

  5. Your Email: test@test.com

  6. 点击Install WordPress按键,得到安装成功界面

Quickly build a WordPress blog system in ten minutes

使用sequoiadb:sequoiadb作为用户名密码登录

Quickly build a WordPress blog system in ten minutes

更换桌面主题

Quickly build a WordPress blog system in ten minutesQuickly build a WordPress blog system in ten minutesQuickly build a WordPress blog system in ten minutes回到Wordpress博客首页,可以尝试更改博客内容或添加评论

Quickly build a WordPress blog system in ten minutes

简单编辑文章后

Quickly build a WordPress blog system in ten minutes

结论

SequoiaDB巨杉数据库作为一款分布式数据库,提供包括结构化SQL、非结构化文件系统和对象存储的机制

 

通过SequoiaDB创建的MySQL实例,能够提供与标准MySQL全兼容的SQL与DDL能力,用户无需调整DDL或SQL即可实现无缝透明地访问分布式表结构。

 

本文向读者展示了如何通过SequoiaDB的MySQL实例,实现与标准MySQL的无缝迁移。通过使用SequoiaDB巨杉数据库,用户可以在满足标准ACID与MySQL协议的基础上,实现近无限的弹性扩展能力

推荐教程:MySQL视频教程

The above is the detailed content of Quickly build a WordPress blog system in ten minutes. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template