Jump to content

syn9673

Members
  • Posts

    89
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by syn9673

  1. Super Simple and Lightweight Mysql Database Backup


     sqlbackup
    A super simple and lightweight SQL Database Backup System.  
    This auto backsup your database every 24 Hours or more. Can't go less.

    Requirements
    - NodeJS v12+  
    - Understanding

    Installation
    - Download the Code. (can use git)  
    - Go to the main directory of the code using your terminal/cmd. (Where index.js is)  

    // run
    $ node .
    // or
    $ node index


    How to run this 24/7?
    This will close when you close your terminal. I good way to keep this up without closing is using `pm2`.  
    To install `pm2`, simply do the following.  

    $ npm install pm2 -g
    // or
    $ yarn add pm2 -g

    How would i run it?

    $ pm2 start index.js

    (Make sure you're in the main directory of the code. Where index.js is)  
    That would make it run 24/7 even when closing the terminal/cmd.

    Config
    Defaults:  

    {
      "mysql": {
        "username": "username",
        "password": "password",
        "host": "localhost",
        "port": 3306,
        "databases": [
          "rathena4444_rag",
          "rathena4444_log"
        ]
      },
    
      "backupInterval": 86400
    }

    config.mysql is where all your mysql data would be.  
    *.username is what your mysql username is.  
    *.password is the password for your mysql username.  
    *.host is where the mysql server is hosted. 127.0.0.1 or localhost for the same host or vps.  
    *.port is the port of the mysql host.
    *.databases[] an array of the name of the databases to backup.  

    config.backupInterval is the amount of seconds to wait before creating a new backup. Default is 86400 (1 day).  
    Take note that you can't go less than 86400.

    How does this work?
    I simply used child_process to create a new process and would run mysqldump to export Mysql databases.  
    After exporting, the code closes the process of the ran command and then would wait for the interval to be finished, then repeat the process.


    • Submitter
      [[Template core/front/global/userLink is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]
    • Submitted
      04/10/20
    • Category
    • Video
    • Content Author
      Alexander9673

     

  2. A much faster and easier way that worked for me is installing node.js.
    Once installing it, simply open Windows Powershell as Admin then run `npm install windows-build-tools -g`
    After that, open start menu and find MSBuild Command Prompt. Then go to your rAthena dir and build using `msbuild`.
    You could also try finding where `msbuild.exe` is located then add it to your path for much easier access.

  3. sqlbackup
    A super simple and lightweight SQL Database Backup System.  
    This auto backsup your database every 24 Hours or more. Can't go less.

    Download (Code Here)

    Requirements
    - NodeJS v12+  
    - Understanding

    Installation
    - Download the Code. (can use git)  
    - Go to the main directory of the code using your terminal/cmd. (Where index.js is)  

    // run
    $ node .
    // or
    $ node index


    How to run this 24/7?
    This will close when you close your terminal. I good way to keep this up without closing is using `pm2`.  
    To install `pm2`, simply do the following.  

    $ npm install pm2 -g
    // or
    $ yarn add pm2 -g

    How would i run it?

    $ pm2 start index.js

    (Make sure you're in the main directory of the code. Where index.js is)  
    That would make it run 24/7 even when closing the terminal/cmd.

    Config
    Defaults:  

    {
      "mysql": {
        "username": "username",
        "password": "password",
        "host": "localhost",
        "port": 3306,
        "databases": [
          "rathena4444_rag",
          "rathena4444_log"
        ]
      },
    
      "backupInterval": 86400
    }

    config.mysql is where all your mysql data would be.  
    *.username is what your mysql username is.  
    *.password is the password for your mysql username.  
    *.host is where the mysql server is hosted. 127.0.0.1 or localhost for the same host or vps.  
    *.databases[] an array of the name of the databases to backup.  

    config.backupInterval is the amount of seconds to wait before creating a new backup. Default is 86400 (1 day).  
    Take note that you can't go less than 86400.

    How does this work?
    I simply used child_process to create a new process and would run mysqldump to export Mysql databases.  
    After exporting, the code closes the process of the ran command and then would wait for the interval to be finished, then repeat the process.
     

    • Upvote 2
    • MVP 1
  4. On 5/6/2019 at 8:17 PM, iAmGnome said:

    Possible but not really. Floating IP can be classified as just an OM IP (not sure how to term it). It is where you deploy an instance (1+1) when an instance goes down you don't need to change the IP of it since the floating is routed to both instance. (weird explanation)  

    Why not just use the floating ip as the server ip?

  5. How does fluxcp insert the YYYY-MM-DD format in birthdate, cause when i do it, it is formatted to iso. Thanks.
    Edit: ( Making it much clearer )
    Was wandering what does fluxcp do in order to save YYYY-MM-DD format to the birthdate column. Because when i did it, using nodejs. It formatted it to an ISO Date. Anyone knows why?

  6. On 4/2/2019 at 1:02 AM, Schreimind said:

    What if my LAN IP AND WAN IP aren't the same what should i do sorry i don't really understand this thing

    image.thumb.png.e6907ab644e2ec42c5dc535782621d7a.png

    You don't need to do those, just make sure that your ragnarok server and vps server is in the same ip/machine. Grab your ip by searching "What's my ip". And once you have it, just open ports for that ip.
    If you're on a VPS, use that ip. And open the ports for char, map and login server. By default those ports are 6900, 5121, 6121

  7. On 5/4/2019 at 10:31 PM, Mosaic said:

    Use the command "@accinfo %playersname%" in-game. Tested this guide multiple times and it works like a charm.

    Won't that give the ip of the player? And not the server's ip through packets?

    On 5/4/2019 at 9:36 PM, iAmGnome said:

    Not quite sure with regards to floating IPS of DigitalOcean. Better to try it but somehow it will work since it is integrated on their droplet which can use CentOS system. As for cloudfare, it won't work AFAIK since it only caters web traffic.

    I havn't tested yet since i don't know how to get packets data. But i think ( not sure though. ) that floating ips are different ips that does the same what the original ip does. Basically like a proxy. Correct me if i'm wrong though.

    Here's a blog, if you need a much clear description.
    https://blog.digitalocean.com/floating-ips-start-architecting-your-applications-for-high-availability/

  8. On 4/30/2019 at 3:59 PM, iAmGnome said:

    Hello there,

    Some of you might know this already and maybe have read the original guide for it. But for those who doesn't know it yet, see below.

    Note: I’m sharing the steps on how to do it using CentOS7 for the proxy server/VM while the main server/VM will be anything you like as long as rAthena supports it.

    Before everything else, I would like you to know that this guide will only work on CentOS7 and this doesn’t guarantee that it will provide low latency to your players since its main function is to HIDE the IP of your MAIN VPS to avoid being bombarded with unwanted traffic. In the event, you received lots of traffic on your proxy, you can just reject it on your main VPS via firewall rules/iptables.

    Requirements

    1. Spare VPS to configure the proxy
    2. Patch your client using updated "Enable Proxy Support" patch provided by 4144's NEMO & Functor
    3. DO NOT patch "Skip Service Select" since you need it to choose from the multiple connections.
    4. Add multiple connection on your clientinfo.xml/sclientinfo.xml
    5. Configure subnet_athena.conf to prevent sending real IP in network packets from login and char servers. (Functor)
    6. (Optional) Enable "Cancel to Select Service" Patch

    VPS Configuration (IMPORTANT)

    Note: Again, make sure that your VPS is using CentOS7 since this was tested under the said OS and working 100%

    Follow the commands provided below.

    
    /* Port Forwarding CentOS 7 FirewallD */
    // ========================================================================
    // Please read the comments per line it is self-explanatory.
    // Important Parameters:
    // INSERT_ZONE = output of the get default zone
    // INSERT_IP = is the public IP of your main VPS or server
    // If you like the guide give it a thumbs up!
    // ========================================================================
    
    // This command is to get the default zone being used by your VM.
    firewall-cmd --get-default-zone
    
    // This command is to check all rules applied to your VM by the current active zone.
    firewall-cmd --zone=INSERT_ZONE --list-all
    
    // Enabling Masquerade Status (IP Forwarding). 
    // This is the important configuration else below won't work
    firewall-cmd --zone=INSERT_ZONE --add-masquerade --permanent
    
    // IP/Traffic forwarding
    // Make sure you have configured masquerade
    firewall-cmd --zone="INSERT_ZONE" --add-forward-port=port=6900:proto=tcp:toport=6900:toaddr=INSERT_IP --permanent
    firewall-cmd --zone="INSERT_ZONE" --add-forward-port=port=6121:proto=tcp:toport=6121:toaddr=INSERT_IP --permanent
    firewall-cmd --zone="INSERT_ZONE" --add-forward-port=port=5121:proto=tcp:toport=5121:toaddr=INSERT_IP --permanent
    
    // Add rules for ro-ports (assuming that you didn't change the port)
    firewall-cmd --zone=INSERT_ZONE --add-port=6900/tcp --permanent
    firewall-cmd --zone=INSERT_ZONE --add-port=6121/tcp --permanent
    firewall-cmd --zone=INSERT_ZONE --add-port=5121/tcp --permanent
    
    // Reload rules to take effect
    firewall-cmd --reload

    clientinfo.xml/sclientinfo.xml Configuration (IMPORTANT)

    The example below shows how to configure multiple connections/tunnel to your VPS. (P.S. I'm not quite sure how many connection is the limit that can be defined on the xml)

    
    <?xml version="1.0" encoding="euc-kr" ?>
    <clientinfo>
    	<desc>Ragnarok Online Client Information</desc>
    	<servicetype>america</servicetype>
    	<servertype>primary</servertype>
    	<connection>
    		<display>^FF0000[ SE Asia ]^000000 - Connection Tunnel</display>
    		<balloon>This server is dedicated to SEA Region to possibly reduce latency.</balloon>
          		<address>INSERT_IP_HERE</address>
          		<port>6900</port>
          		<version>46</version>
          		<langtype>1</langtype>
    		<registrationweb>https://rathena.org/board</registrationweb>
    		<loading>
    			<image>loading00.jpg</image>
    			<image>loading01.jpg</image>
    		</loading>
    		<yellow>
    			<admin>2000000</admin>
    		</yellow>
       	</connection>
    	<connection>
    		<display>^FF0000[ US Central ]^000000 - Connection Tunnel</display>
    		<balloon>This server is dedicated to US Central Region to possibly reduce latency.</balloon>
          		<address>INSERT_IP_HERE</address>
          		<port>6900</port>
          		<version>46</version>
          		<langtype>1</langtype>
    		<registrationweb>https://rathena.org/board</registrationweb>
    		<loading>
    			<image>loading00.jpg</image>
    			<image>loading01.jpg</image>
    		</loading>
    		<yellow>
    			<admin>2000000</admin>
    		</yellow>
       	</connection>
    	<connection>
    		<display>^FF0000[ US West ]^000000 - Connection Tunnel</display>
    		<balloon>This server is dedicated to US West Region to possibly reduce latency.</balloon>
          		<address>INSERT_IP_HERE</address>
          		<port>6900</port>
          		<version>46</version>
          		<langtype>1</langtype>
    		<registrationweb>https://rathena.org/board</registrationweb>
    		<loading>
    			<image>loading00.jpg</image>
    			<image>loading01.jpg</image>
    		</loading>
    		<yellow>
    			<admin>2000000</admin>
    		</yellow>
       	</connection>
    </clientinfo>

    subnet_athena.conf (IMPORTANT)

    Change the default value (shown below)

    
    subnet: 255.0.0.0:127.0.0.1:127.0.0.1

    TO

    
    subnet: 0.0.0.0:127.0.0.1:127.0.0.1

    As per Functor, "If you will just apply the patch of EXE - game client will not use these IPs from network packets. But players will be able to find real IP by using any network sniffer.".

    That's it. If you have question, drop by a comment. ROK On!

    Original Links: Ragnarok Proxy Setup (Hide your VPS IP)
    Other: rAthena via GCP (In a nutshell)

    Would Cloudflare be enough? Or is it just for web? Also, we could also use Floating IPs from Digitalocean right?

×
×
  • Create New...