Portainer Basic
Portainer enables centralized configuration, management and security of Kubernetes and Docker environments, allowing you to deliver ‘Containers-as-a-Service’ to your users quickly, easily and securely.
Portainer enables centralized configuration, management and security of Kubernetes and Docker environments, allowing you to deliver ‘Containers-as-a-Service’ to your users quickly, easily and securely.
Table of Contents
Synology uses btrfs as filesystem, which lack of support for bad sector as it natively not supported by btrfs. ZFS could be the choise because of some advantages below.
Although Synology also can hand bad sector, but btrfs doesn't. Not sure how Synology handle it, but bad sectors can cause Synology volumes crash, and then volumes will be in read only mode, reconfiguration required and taking time to move volumes out from impacted volumes.
This is an intersting feature of ZFS. The btrfs dedup can be done by running scripts, but ZFS can do natively.
FreeNAS/TrueNAS has many feature and got full functions of NAS feature.
FreeNAS/TrueNAS doesn't support ARM CPU, and cheap ARM board, such as Raspberry PI 4, doesn't support SATA, and 4 SATA drives should be considered for normal NAS. So not intend to use ARM board for NAS.
Decided to try FreeNAS/TrueNAS using an old PC installed ESXi, which has 32GB RAM, 8 theads CPU, and 10GB Ethernet.
Assign 8GB RAM and 2 theads to FreeNAS VM, set hot plug memory and CPU in order to increase memory and CPU dynamically.
Note: Error occurred when add memory to VM. See post Error on adding hot memory to TrueNAS VM.
Create RDM disk access hard disk directly to improve disk performance.
Create VM network interface which supports 10GB.
Create iSCSI disk to hold VM image, because RDM disk vmdk file can not be created in NFS.
Although the ESXi is managed by vCenter, but could not find the place to configure iSCSI device. So login to ESXi web interface, and configure iSCSI in Storage -> Adapters.
Note: Target is IQN, not name.
During the creation, ESXi shows an error that two network interfaces had detected on network used by iSCSI, so I removed second standby interface during iSCSI adapter creation, then put back again after creation completed.
Following instructions given by Raw Device Mapping for local storage (1017530), to create RDM disk.
Open an SSH session to the ESXi host.
Run this command to list the disks that are attached to the ESXi host:
ls -l /vmfs/devices/disks
From the list, identify the local device you want to configure as an RDM and copy the device name.
Note: The device name is likely be prefixed with t10. and look similar to:
t10.F405E46494C4540046F455B64787D285941707D203F45765
To configure the device as an RDM and output the RDM pointer file to your chosen destination, run this command:
vmkfstools -z /vmfs/devices/disks/diskname /vmfs/volumes/datastorename/vmfolder/vmname.vmdk
For example:
vmkfstools -z /vmfs/devices/disks/t10.F405E46494C4540046F455B64787D285941707D203F45765 /vmfs/volumes/Datastore2/localrdm1/localrdm1.vmdk
Note: The size of the newly created RDM pointer file appears to be the same size and the Raw Device it it mapped to, this is a dummy file and is not consuming any storage space.
When you have created the RDM pointer file, attach the RDM to a virtual machine using the vSphere Client:
You should now see your new hard disk in the virtual machine inventory as Mapped Raw LUN.
Create VM using following parameters
Configure network in FreeNAS console, and configure pool, dataset, user, sharing, ACL in FreeNAS website.
Configure IP address
Using browser to access IP configured in previous step
Configure DNS
Default route is added in static route as 0.0.0.0 to gateway.
Configure timezone
Configure Pool by giving pool name pool01
Under Pool, add Dataset, such as download
Create user to be used later in ACL.
Create SMB sharing
Assign owner and group to user created above, and select mode as Restrict
.
Select Export/Disconnect
in setting of pool.
The biggest issue encountered is, ESXi hangs, complains one PCPU freezing. Will try to install usb drive directly to see whether problem only happens on ESXi.
Fast as excepted
They are not comparable, because DS2419+ has more disks in the volume.
They are not comparable, because DS1812+ has three slow disks with raid in the volume.
Table of Contents
In order to fully utilize system by FreeNAS, also like to test whether similar hanging issue happened when directly installed on USB drive without ESXi, installation had been done with following steps.
Creating USB drive on Mac using steps mentioned below.
Using rdiskX, which is raw device (not read-only device), will be faster as mentioned in the instructions.
dd if=FreeNAS-9.3-RELEASE-x64.iso of=/dev/rdisk1 bs=64k
Boot from the USB drive created above, and another USB drive will be used for installation.
By choosing BIOS instead of UEFI, the PC bios could not set as auto boot from USB drive, but it can be chosen for manual boot. So choose UEFI mode instead.
Secure Boot
in PC bios also requires to be set to Other OS
instead of Windows UEFI
, otherwise, following error will occurre.
System found unauthorized changes on the firmware error...
To set aggragation mode, two original interfaces which had configured, will not be displayed in aggragation menu.
IP address will be configured on aggragation interface.
Table of Contents
Devices: ds1812+ and ds2419+
@eaDir
in everywhere, which can be issue when using some services, and huge number of small files in it.Just started on an i7 PC with 32GB ram.
In order to have a complete document in each blog, blog title is saved in blog body as well.
Blog appears in blog list with title in blog body.
Blog appears in blog list without title (hidden) in blog body.
To hide the blog title in blog list, which is in <h1>
or #
form, using following code.
.wpbstarter-blog-list .entry-content h1 {
display: none;
}
Another way to hide it, this can have more control.
.wpbstarter-blog-list .entry-content h1 {
font-size: 0;
width: 1px;
height: 1px;
display: inline-block;
overflow: hidden;
position: absolute!important;
border: 0!important;
padding: 0!important;
margin: 0!important;
clip: rect(1px,1px,1px,1px);
}
Table of Contents
MySQL Cheat Sheet provides you with one-page that contains the most commonly used MySQL commands and statements that help you work with MySQL more effectively.
Connect to MySQL server using mysql command-line client with a username and password (MySQL will prompt for a password):
mysql -u [username] -p;
Connect to MySQL Server with a specified database using a username and password:
mysql -u [username] -p [database];
Exit mysql command-line client:
exit;
Export data using mysqldump tool
mysqldump -u [username] -p [database] > data_backup.sql;
To clear MySQL screen console window on Linux, you use the following command:
mysql> system clear;
Currently, there is no command available on Windows OS for clearing MySQL screen console window.
Create a database with a specified name if it does not exist in the database server
CREATE DATABASE [IF NOT EXISTS] database_name;
Use a database or change the current database to another database that you are working with:
USE database_name;
Drop a database with a specified name permanently. All physical files associated with the database will be deleted.
DROP DATABASE [IF EXISTS] database_name;
Show all available databases in the current MySQL database server
SHOW DATABASE;
Show all tables in a current database.
SHOW TABLES;
CREATE TABLE [IF NOT EXISTS] table_name(
column_list
);
Add a new column into a table:
ALTER TABLE table
ADD [COLUMN] column_name;
Drop a column from a table:
ALTER TABLE table_name
DROP [COLUMN] column_name;
Add index with a specific name to a table on a column:
ALTER TABLE table
ADD INDEX [name](column, ...);
Add primary key into a table:
ALTER TABLE table_name
ADD PRIMARY KEY (column_name,...);
Remove the primary key of a table:
ALTER TABLE table_name
DROP PRIMARY KEY;
DROP TABLE [IF EXISTS] table_name;
Show the columns of a table:
DESCRIBE table_name;
Show the information of a column in a table:
DESCRIBE table_name column_name;
Creating an index with the specified name on a table:
CREATE INDEX index_name
ON table_name (column,...);
DROP INDEX index_name;
CREATE UNIQUE INDEX index_name
ON table_name (column,...);
Create a new view:
CREATE VIEW [IF NOT EXISTS] view_name
AS
select_statement;
Create a new view with the WITH CHECK OPTION
:
CREATE VIEW [IF NOT EXISTS] view_name
AS select_statement
WITH CHECK OPTION;
Create or replace a view:
CREATE OR REPLACE view_name
AS
select_statement;
Drop a view:
DROP VIEW [IF EXISTS] view_name;
Drop multiple views:
DROP VIEW [IF EXISTS] view1, view2, ...;
Rename a view:
RENAME TABLE view_name
TO new_view_name;
Show views from a database:
SHOW FULL TABLES
[{FROM | IN } database_name]
WHERE table_type = 'VIEW';
Create a new trigger:
CREATE TRIGGER trigger_name
{BEFORE | AFTER} {INSERT | UPDATE| DELETE }
ON table_name FOR EACH ROW
trigger_body;
Drop a trigger:
DROP TRIGGER [IF EXISTS] trigger_name;
Show triggers in a database:
SHOW TRIGGERS
[{FROM | IN} database_name]
[LIKE 'pattern' | WHERE search_condition];
Create a stored procedure:
DELIMITER $$
CREATE PROCEDURE procedure_name(parameter_list)
BEGIN
body;
END $$
DELIMITER ;
Drop a stored procedure:
DROP PROCEDURE [IF EXISTS] procedure_name;
Show stored procedures:
SHOW PROCEDURE STATUS
[LIKE 'pattern' | WHERE search_condition];
Create a new stored function:
DELIMITER $$
CREATE FUNCTION function_name(parameter_list)
RETURNS datatype
[NOT] DETERMINISTIC
BEGIN
-- statements
END $$
DELIMITER ;
Drop a stored function:
DROP FUNCTION [IF EXISTS] function_name;
Show stored functions:
SHOW FUNCTION STATUS
[LIKE 'pattern' | WHERE search_condition];
Query all data from a table:
SELECT * FROM table_name;
Query data from one or more column of a table:
SELECT
column1, column2, ...
FROM
table_name;
Remove duplicate rows from the result of a query:
SELECT
DISTINCT (column)
FROM
table_name;
Query data with a filter using a <a href="https://www.mysqltutorial.org/mysql-where/">WHERE</a>
clause:
SELECT select_list
FROM table_name
WHERE condition;
Change the output of the column name using column alias:
SELECT
column1 AS alias_name,
expression AS alias,
...
FROM
table_name;
Query data from multiple tables using inner join:
SELECT select_list
FROM table1
INNER JOIN table2 ON condition;
Query data from multiple tables using left join:
SELECT select_list
FROM table1
LEFT JOIN table2 ON condition;
Query data from multiple tables using right join:
SELECT select_list
FROM table1
RIGHT JOIN table2 ON condition;
Make a Cartesian product of rows:
SELECT select_list
FROM table1
CROSS JOIN table2;
Counting rows in a table.
SELECT COUNT(*)
FROM table_name;
Sorting a result set:
SELECT
select_list
FROM
table_name
ORDER BY
column1 ASC [DESC],
column2 ASC [DESC];
Group rows using the GROUP BY
clause.
SELECT select_list
FROM table_name
GROUP BY column_1, column_2, ...;
Filter group using the <a href="https://www.mysqltutorial.org/mysql-having.aspx">HAVING</a>
clause:
SELECT select_list
FROM table_name
GROUP BY column1
HAVING condition;
Insert a new row into a table:
INSERT INTO table_name(column_list)
VALUES(value_list);
Insert multiple rows into a table:
INSERT INTO table_name(column_list)
VALUES(value_list1),
(value_list2),
(value_list3),
...;
Update all rows in a table:
UPDATE table_name
SET column1 = value1,
...;
Update data for a set of rows specified by a condition in WHERE
clause.
UPDATE table_name
SET column_1 = value_1,
...
WHERE condition
UPDATE
table1,
table2
INNER JOIN table1 ON table1.column1 = table2.column2
SET column1 = value1,
WHERE condition;
DELETE FROM table_name;
Delete rows specified by a condition:
DELETE FROM table_name
WHERE condition;
DELETE table1, table2
FROM table1
INNER JOIN table2
ON table1.column1 = table2.column2
WHERE condition;
Search for data using the <a href="https://www.mysqltutorial.org/mysql-like/">LIKE</a>
operator:
SELECT select_list
FROM table_name
WHERE column LIKE '%pattern%';
Text search using a regular expression with RLIKE
operator.
SELECT select_list
FROM table_name
WHERE column RLIKE 'regular_expression';
Use a free tool called FLAC Frontend.
Following command can be used to scan ~/Music
folder for all FLAC files, and test them.
find ~/Music -type f -iname '*.flac' -print0 | xargs --null flac -wst
For ASUS motherboard, ESXi unable to detect the harddisk which has special hotplug or eSATA feature.
ASUS BIOS can detect the harddisk, but it could not be found in ESXi storage device menu.
Connect harddisk to different SATA port.
Some issues encountered when using rsync to duplicate filesystem.
When duplicating the files, rsync didn't take care of extended attributes, users might lose rights on some files.
In order to create/update sparse files, to steps required.
To create new files in sparse mode
rsync --ignore-existing --sparse ...
To update all existing files (including the previously created sparse ones) inplace.
rsync --inplace ...
Got following error when changing memory size of TrueNAS VM dynamically.
Failed - Invalid virtual machine configuration.